本文整理汇总了PHP中formatCurrency函数的典型用法代码示例。如果您正苦于以下问题:PHP formatCurrency函数的具体用法?PHP formatCurrency怎么用?PHP formatCurrency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatCurrency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setvar
function setvar($key, $value, $formatCurrency = false)
{
if ($formatCurrency) {
$value = formatCurrency($value);
}
$this->tpl->set_var($key, html_entity_to_alpha($value));
}
示例2: renderColumn
public static function renderColumn(CAppUI $AppUI, $fieldName, $row)
{
switch ($fieldName) {
case 'project_creator':
case 'project_owner':
$s .= '<td nowrap="nowrap">';
$s .= w2PgetUsernameFromID($row[$fieldName]);
$s .= '</td>';
break;
case 'project_target_budget':
case 'project_actual_budget':
$s .= '<td>';
$s .= $w2Pconfig['currency_symbol'];
$s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM'));
$s .= '</td>';
break;
case 'project_url':
case 'project_demo_url':
$s .= '<td>';
$s .= w2p_url($row[$fieldName]);
$s .= '</td>';
break;
case 'project_start_date':
case 'project_end_date':
$df = $AppUI->getPref('SHDATEFORMAT');
$myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null;
$s .= '<td nowrap="nowrap" class="center">' . ($myDate ? $myDate->format($df) : '-') . '</td>';
break;
default:
$s .= '<td nowrap="nowrap" class="center">';
$s .= htmlspecialchars($row[$fieldName], ENT_QUOTES);
$s .= '</td>';
}
return $s;
}
示例3: ah_formatstat
function ah_formatstat($billingcycle, $stat)
{
global $data, $currency, $currencytotal;
$value = array_key_exists($billingcycle, $data) ? $data[$billingcycle][$stat] : '';
if (!$value) {
$value = 0;
}
if ($stat == "sum") {
if ($billingcycle == "Monthly") {
$currencytotal += $value * 12;
} elseif ($billingcycle == "Quarterly") {
$currencytotal += $value * 4;
} elseif ($billingcycle == "Semi-Annually") {
$currencytotal += $value * 2;
} elseif ($billingcycle == "Annually") {
$currencytotal += $value;
} elseif ($billingcycle == "Biennially") {
$currencytotal += $value / 2;
} elseif ($billingcycle == "Triennially") {
$currencytotal += $value / 3;
}
$value = formatCurrency($value);
}
return $value;
}
示例4: parseValue
public function parseValue($type, $item)
{
foreach ($item as $field => $value) {
switch ($field) {
case 'defaultPrice':
$parsed[$field] = formatCurrency($value);
break;
default:
$parsed[$field] = $value;
}
if (isset($parsed[$field]) && $field != 'defaultPrice') {
$parsed[$field] = htmlspecialchars($parsed[$field], ENT_QUOTES | ENT_HTML5, 'UTF-8');
}
}
return $parsed;
}
示例5: widget_open_invoices
function widget_open_invoices($vars)
{
global $_ADMINLANG, $currency;
$title = $_ADMINLANG['home']['openinvoices'];
if (!function_exists("getGatewaysArray")) {
require ROOTDIR . "/includes/gatewayfunctions.php";
}
$gatewaysarray = getGatewaysArray();
$content = '<table class="table table-condensed">
<tr style="background-color:#efefef;font-weight:bold;text-align:center"><td>' . $_ADMINLANG['fields']['invoicenum'] . '</td><td>' . $_ADMINLANG['fields']['clientname'] . '</td><td>' . $_ADMINLANG['fields']['invoicedate'] . '</td><td>' . $_ADMINLANG['fields']['duedate'] . '</td><td>' . $_ADMINLANG['fields']['totaldue'] . '</td><td>' . $_ADMINLANG['fields']['paymentmethod'] . '</td><td width="20"></td></tr>
';
$id = '';
$query = "SELECT tblinvoices.*,tblinvoices.total-COALESCE((SELECT SUM(amountin) FROM tblaccounts WHERE tblaccounts.invoiceid=tblinvoices.id),0) AS invoicebalance,tblclients.firstname,tblclients.lastname FROM tblinvoices INNER JOIN tblclients ON tblclients.id=tblinvoices.userid WHERE tblinvoices.status='Unpaid' ORDER BY duedate,date ASC LIMIT 0,5";
$result = full_query($query);
while ($data = mysql_fetch_array($result)) {
$id = $data["id"];
$invoicenum = $data["invoicenum"];
$userid = $data["userid"];
$firstname = $data["firstname"];
$lastname = $data["lastname"];
$date = $data["date"];
$duedate = $data["duedate"];
$total = $data["total"];
$invoicebalance = $data["invoicebalance"];
$paymentmethod = $data["paymentmethod"];
$paymentmethod = $gatewaysarray[$paymentmethod];
$date = fromMySQLDate($date);
$duedate = fromMySQLDate($duedate);
$currency = getCurrency($userid);
if (!$invoicenum) {
$invoicenum = $id;
}
$content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="invoices.php?action=edit&id=' . $id . '">' . $invoicenum . '</a></td><td>' . $firstname . ' ' . $lastname . '</td><td>' . $date . '</td><td>' . $duedate . '</td><td>' . formatCurrency($total) . '</td><td>' . $paymentmethod . '</td><td><a href="invoices.php?action=edit&id=' . $id . '"><img src="images/edit.gif" border="0" /></a></td></tr>';
}
if (!$id) {
$content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">' . $_ADMINLANG['global']['norecordsfound'] . '</td></tr>';
}
$content .= '</table>
<div class="widget-footer">
<a href="invoices.php?status=Unpaid" class="btn btn-info btn-sm">' . $_ADMINLANG['home']['viewall'] . ' »</a>
</div>';
return array('title' => $title, 'content' => $content);
}
示例6: parseValue
public function parseValue($type, $item)
{
foreach ($item as $field => $value) {
switch ($field) {
case 'discountType':
$parsed[$field] = $value == 'C' ? 'Cash' : 'Percentage';
break;
case 'discountAmount':
$parsed[$field] = $item['discountType'] == 'C' ? formatCurrency($value) : $value + 0 . '%';
break;
default:
$parsed[$field] = $value;
}
if (isset($parsed[$field]) && ($field != 'discountAmount' || $field == 'discountAmount' && $item['discountType'] != 'C')) {
$parsed[$field] = htmlspecialchars($parsed[$field], ENT_QUOTES | ENT_HTML5, 'UTF-8');
}
}
return $parsed;
}
示例7: compoundInterest
function compoundInterest($investment, $interest_rate, $years, $compound_monthly = false)
{
// calculate the future value
$is_compounded_monthly = '';
$future_value = $investment;
for ($i = 1; $i <= $years; $i++) {
if ($compound_monthly) {
$future_value = $future_value * pow(1 + $interest_rate / (100 * 12), 12);
$is_compounded_monthly = "Yes";
} else {
$future_value = $future_value + $future_value * $interest_rate * 0.01;
$is_compounded_monthly = "No";
}
}
// apply currency and percent formatting
$investment_f = formatCurrency($investment);
$yearly_rate_f = formatPercentage($interest_rate);
$future_value_f = formatCurrency($future_value);
include 'display_results.php';
}
示例8: chartdata_income
function chartdata_income()
{
global $currency;
$currency = getCurrency();
$chartdata = array();
$chartdata['cols'][] = array('label' => 'Day', 'type' => 'string');
$chartdata['cols'][] = array('label' => 'Income', 'type' => 'number');
$chartdata['cols'][] = array('label' => 'Expenditure/Refunds', 'type' => 'number');
for ($i = 14; $i >= 0; $i--) {
$date = mktime(0, 0, 0, date("m"), date("d") - $i, date("Y"));
$data = get_query_vals("tblaccounts", "SUM(amountin/rate),SUM(amountout/rate)", "date LIKE '" . date("Y-m-d", $date) . "%'");
if (!$data[0]) {
$data[0] = 0;
}
if (!$data[1]) {
$data[1] = 0;
}
$chartdata['rows'][] = array('c' => array(array('v' => date("dS", $date)), array('v' => (int) $data[0], 'f' => formatCurrency($data[0])), array('v' => (int) $data[1], 'f' => formatCurrency($data[1]))));
}
return $chartdata;
}
示例9: Main
//.........这里部分代码省略.........
}
$this->tpl->set_var("idle", $this->formArray["idle"]);
}
}
// grab DueRecords from tdID
$DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
$dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) {
if ($this->formArray["rptopID"] != "") {
$redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
} else {
$redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
}
exit($redirectMessage);
} else {
if (!($domDoc = domxml_open_mem($xmlStr))) {
if ($this->formArray["rptopID"] != "") {
$redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
} else {
$redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
}
exit($redirectMessage);
} else {
$dueRecords = new DueRecords();
$dueRecords->parseDomDocument($domDoc);
foreach ($dueRecords->getArrayList() as $due) {
foreach ($due as $dueKey => $dueValue) {
switch ($dueKey) {
case "dueType":
if ($dueValue == "Annual") {
$this->formArray["totalTaxDue"] += $due->getTaxDue();
}
$dueArrayList[$dueValue] = $due;
$this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax()));
$this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax()));
$this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax()));
$this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue()));
$this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate())));
$dueDateYear = date("Y", strtotime($due->getDueDate()));
$this->tdRecord["year"] = $dueDateYear;
break;
}
}
}
$treasurySettings = new TreasurySettings();
$treasurySettings->selectRecord();
// initialize discountPeriod and discountPercentage for earlyPaymentDiscount
$this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%");
$this->tpl->set_var("discountPeriod", "January 01, " . $dueDateYear . " - " . date("F d, Y", strtotime($dueDateYear . "-" . $treasurySettings->getDiscountPeriod())));
$this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
$this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
$this->formArray["discountPeriod_End"] = strtotime($dueDateYear . "-" . $this->formArray["discountPeriod"]);
$this->formArray["discountPeriod_Start"] = strtotime($dueDateYear . "-01-01");
// initialize advancedDiscountPercentage for advancedPayment
$this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%");
$this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
$this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%");
$this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
// initialize penaltyLUTArray
$penaltyLUTArray = $treasurySettings->getPenaltyLUT();
$this->penaltyLUTArray = $treasurySettings->getPenaltyLUT();
foreach ($dueArrayList as $dKey => $due) {
$dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]);
$dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]);
// compute earlyPaymentDiscount as of today
// check if today is within the discountPeriod and compute Discount
示例10: formatCurrencyFigures
function formatCurrencyFigures()
{
$suffixKey = 1;
for ($suffixKey = 1; $suffixKey <= 11; $suffixKey++) {
$this->formArray["paidBasic" . $suffixKey] = formatCurrency($this->formArray["paidBasic" . $suffixKey]);
$this->formArray["discountBasic" . $suffixKey] = formatCurrency($this->formArray["discountBasic" . $suffixKey]);
$this->formArray["priorBasic" . $suffixKey] = formatCurrency($this->formArray["priorBasic" . $suffixKey]);
$this->formArray["penaltyBasic" . $suffixKey] = formatCurrency($this->formArray["penaltyBasic" . $suffixKey]);
$this->formArray["priorPenaltyBasic" . $suffixKey] = formatCurrency($this->formArray["priorPenaltyBasic" . $suffixKey]);
$this->formArray["totalNetBasic" . $suffixKey] = formatCurrency($this->formArray["totalNetBasic" . $suffixKey]);
$this->formArray["paidSEF" . $suffixKey] = formatCurrency($this->formArray["paidSEF" . $suffixKey]);
$this->formArray["discountSEF" . $suffixKey] = formatCurrency($this->formArray["discountSEF" . $suffixKey]);
$this->formArray["priorSEF" . $suffixKey] = formatCurrency($this->formArray["priorSEF" . $suffixKey]);
$this->formArray["penaltySEF" . $suffixKey] = formatCurrency($this->formArray["penaltySEF" . $suffixKey]);
$this->formArray["priorPenaltySEF" . $suffixKey] = formatCurrency($this->formArray["priorPenaltySEF" . $suffixKey]);
$this->formArray["totalNetSEF" . $suffixKey] = formatCurrency($this->formArray["totalNetSEF" . $suffixKey]);
$this->formArray["paidIdle" . $suffixKey] = formatCurrency($this->formArray["paidIdle" . $suffixKey]);
$this->formArray["priorIdle" . $suffixKey] = formatCurrency($this->formArray["priorIdle" . $suffixKey]);
$this->formArray["penaltyIdle" . $suffixKey] = formatCurrency($this->formArray["penaltyIdle" . $suffixKey]);
$this->formArray["totalIdle" . $suffixKey] = formatCurrency($this->formArray["totalIdle" . $suffixKey]);
$this->formArray["specialLevy" . $suffixKey] = formatCurrency($this->formArray["specialLevy" . $suffixKey]);
$this->formArray["totalNonCash" . $suffixKey] = formatCurrency($this->formArray["totalNonCash" . $suffixKey]);
$this->formArray["grandTotalNetCol" . $suffixKey] = formatCurrency($this->formArray["grandTotalNetCol" . $suffixKey]);
}
$this->formArray["totalPaidBasic"] = formatCurrency($this->formArray["totalPaidBasic"]);
$this->formArray["totalDiscountBasic"] = formatCurrency($this->formArray["totalDiscountBasic"]);
$this->formArray["totalPriorBasic"] = formatCurrency($this->formArray["totalPriorBasic"]);
$this->formArray["totalPenaltyBasic"] = formatCurrency($this->formArray["totalPenaltyBasic"]);
$this->formArray["totalPriorPenaltyBasic"] = formatCurrency($this->formArray["totalPriorPenaltyBasic"]);
$this->formArray["totalTotalNetBasic"] = formatCurrency($this->formArray["totalTotalNetBasic"]);
$this->formArray["totalPaidSEF"] = formatCurrency($this->formArray["totalPaidSEF"]);
$this->formArray["totalDiscountSEF"] = formatCurrency($this->formArray["totalDiscountSEF"]);
$this->formArray["totalPriorSEF"] = formatCurrency($this->formArray["totalPriorSEF"]);
$this->formArray["totalPenaltySEF"] = formatCurrency($this->formArray["totalPenaltySEF"]);
$this->formArray["totalPriorPenaltySEF"] = formatCurrency($this->formArray["totalPriorPenaltySEF"]);
$this->formArray["totalTotalNetSEF"] = formatCurrency($this->formArray["totalTotalNetSEF"]);
$this->formArray["totalPaidIdle"] = formatCurrency($this->formArray["totalPaidIdle"]);
$this->formArray["totalPriorIdle"] = formatCurrency($this->formArray["totalPriorIdle"]);
$this->formArray["totalPenaltyIdle"] = formatCurrency($this->formArray["totalPenaltyIdle"]);
$this->formArray["totalTotalIdle"] = formatCurrency($this->formArray["totalTotalIdle"]);
$this->formArray["totalSpecialLevy"] = formatCurrency($this->formArray["totalSpecialLevy"]);
$this->formArray["totalTotalNonCash"] = formatCurrency($this->formArray["totalTotalNonCash"]);
$this->formArray["totalGrandTotalNetCol"] = formatCurrency($this->formArray["totalGrandTotalNetCol"]);
}
示例11: formatCurrency
}
if ($semiannually >= 0) {
$output .= '<option value="semiannually">' . $_LANG['orderpaymentterm6month'] . ' - ' . formatCurrency($semiannually / 6) . '/mo';
if ($ssetupfee != "0.00") {
$output .= " + " . formatCurrency($ssetupfee) . " " . $_LANG['ordersetupfee'];
}
$output .= '</option>';
}
if ($quarterly >= 0) {
$output .= '<option value="quarterly">' . $_LANG['orderpaymentterm3month'] . ' - ' . formatCurrency($quarterly / 3) . '/mo';
if ($qsetupfee != "0.00") {
$output .= " + " . formatCurrency($qsetupfee) . " " . $_LANG['ordersetupfee'];
}
$output .= '</option>';
}
if ($monthly >= 0) {
$output .= '<option value="monthly">' . $_LANG['orderpaymenttermmonthly'] . ' - ' . formatCurrency($monthly) . '/mo';
if ($msetupfee != "0.00") {
$output .= " + " . formatCurrency($msetupfee) . " " . $_LANG['ordersetupfee'];
}
$output .= '</option>';
}
$output .= '</select>';
}
$output .= ' <input type="submit" value="' . $_LANG['domainordernow'] . '" /></form>';
widgetoutput($output);
function widgetoutput($value)
{
echo "document.write('" . addslashes($value) . "');";
exit;
}
示例12: getTLDPriceList
function getTLDPriceList($tld, $display = "", $renewpricing = "", $userid = "")
{
global $currency;
if ($renewpricing == "renew") {
$renewpricing = true;
}
$currency_id = $currency['id'];
$result = select_query("tbldomainpricing", "id", array("extension" => $tld));
$data = mysql_fetch_array($result);
$id = $data['id'];
if (!$userid && isset($_SESSION['uid'])) {
$userid = $_SESSION['uid'];
}
$clientgroupid = $userid ? get_query_val("tblclients", "groupid", array("id" => $userid)) : "0";
$checkfields = array("msetupfee", "qsetupfee", "ssetupfee", "asetupfee", "bsetupfee", "monthly", "quarterly", "semiannually", "annually", "biennially");
if (!$renewpricing || $renewpricing === "transfer") {
$data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
if (!$data) {
$data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
}
foreach ($checkfields as $k => $v) {
$register[$k + 1] = $data[$v];
}
$data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
if (!$data) {
$data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
}
foreach ($checkfields as $k => $v) {
$transfer[$k + 1] = $data[$v];
}
}
if (!$renewpricing || $renewpricing !== "transfer") {
$data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
if (!$data) {
$data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
}
foreach ($checkfields as $k => $v) {
$renew[$k + 1] = $data[$v];
}
}
$tldpricing = array();
$years = 1;
while ($years <= 10) {
if ($renewpricing === "transfer") {
if (0 < $register[$years] && 0 <= $transfer[$years]) {
if ($display) {
$transfer[$years] = formatCurrency($transfer[$years]);
}
$tldpricing[$years]['transfer'] = $transfer[$years];
}
} else {
if ($renewpricing) {
if (0 < $renew[$years]) {
if ($display) {
$renew[$years] = formatCurrency($renew[$years]);
}
$tldpricing[$years]['renew'] = $renew[$years];
}
} else {
if (0 < $register[$years]) {
if ($display) {
$register[$years] = formatCurrency($register[$years]);
}
$tldpricing[$years]['register'] = $register[$years];
if (0 <= $transfer[$years]) {
if ($display) {
$transfer[$years] = formatCurrency($transfer[$years]);
}
$tldpricing[$years]['transfer'] = $transfer[$years];
}
if (0 < $renew[$years]) {
if ($display) {
$renew[$years] = formatCurrency($renew[$years]);
}
$tldpricing[$years]['renew'] = $renew[$years];
}
}
}
}
$years += 1;
}
return $tldpricing;
}
示例13: generatePDF
public function generatePDF($id, $pdfID)
{
global $dbh;
global $SETTINGS;
$filename = 'Default';
$html = '';
if ($pdfID == 1) {
//TODO: make this look a bit nicer
//TODO: padding doesn't work in tables in tcpdf, another option might be dompdf (https://github.com/dompdf/dompdf)
$filename = 'Invoice';
$html = '<body style="font-size:1em;">
<div style="width:640px; margin:0 auto;">
<span style="font-weight:bold; font-size:1.5em;">' . $SETTINGS['companyName'] . '</span>
<div style="border-bottom: 2px solid #E5E5E5; margin:5px 0;"> </div><br>
Thank you for your order. Your invoice is below.<br><br>';
//get order info
$sth = $dbh->prepare('SELECT date
FROM orders
WHERE orderID = :orderID');
$sth->execute([':orderID' => $id]);
$row = $sth->fetch();
$html .= '<b>Order ID:</b> ' . $id . '<br>
<b>Order Date:</b> ' . formatDate($row['date']) . '<br><br>
<table style="width:100%;">
<thead>
<tr style="font-weight:bold;">
<th style="width:40%;">Item</th>
<th style="text-align:center; width:20%;">Quantity</th>
<th style="text-align:center; width:20%;">Unit Price</th>
<th style="text-align:right; width:20%;">Item Total</th>
</tr>
</thead>
<tbody>';
//get line items
$lineItemTable = self::getLineItemTable($id);
foreach ($lineItemTable[0] as $line) {
if ($line['type'] == 'service' || $line['type'] == 'product') {
$recurringStr = !is_null($line['recurring']) ? ' (occurs monthly on day ' . $line['recurring'][0] . ' from ' . formatDate($line['recurring'][1]) . ' to ' . formatDate($line['recurring'][2]) . ')' : '';
$dateStr = isset($line['date']) ? formatDate($line['date']) . ': ' : '';
$html .= '<tr><td style="width:40%;">' . $dateStr . $line['name'] . $recurringStr . '</td>';
$html .= '<td style="text-align:center; width:20%;">' . formatNumber($line['quantity']) . '</td>';
$html .= '<td style="text-align:center; width:20%;">' . formatCurrency($line['unitPrice']) . '</td>';
$html .= '<td style="text-align:right; width:20%;">' . formatCurrency($line['lineAmount']) . '</td></tr>';
} elseif ($line['type'] == 'discount') {
$unitPrice = $line['discountType'] == 'C' ? formatCurrency(-$line['discountAmount']) : $line['discountAmount'] . '%';
$html .= '<tr><td>Discount: ' . $line['name'] . '</td><td></td>';
$html .= '<td style="text-align:center;">' . $unitPrice . '</td>';
$html .= '<td style="text-align:right;">' . formatCurrency(-$line['lineAmount']) . '</td></tr>';
}
}
$html .= '</tbody>
</table>';
//find amount paid
$sth = $dbh->prepare('SELECT SUM(paymentAmount)
FROM orderPayments
WHERE orderID = :orderID');
$sth->execute([':orderID' => $id]);
$row = $sth->fetch();
$paidAmount = $row['SUM(paymentAmount)'];
//print totals
$html .= '<table style="width:100%; text-align:right;"><tbody>';
$html .= '<tr><td>Total:</td><td>' . formatCurrency($lineItemTable[1]) . '</td></tr>';
$html .= '<tr><td>Amount Paid:</td><td>' . formatCurrency($paidAmount, true) . '</td></tr>';
$html .= '<tr style="font-weight: bold;"><td>Amount Due:</td><td>' . formatCurrency($lineItemTable[1] - $paidAmount, true) . '</td></tr>';
$html .= '</tbody></table>
</div>
</body>
';
}
return [$filename, $html];
}
示例14: foreach
?>
<?php
$this->widget('app.widgets.FlashMessages.FlashMessages');
?>
<?php
echo CHtml::beginForm();
?>
<?php
foreach ($gs['services_premium_cost'] as $row) {
?>
<?php
$msg = Yii::t('main', '{n} день :cost|{n} дня :cost|{n} дней :cost|{n} дня :cost', array($row['days'], ':cost' => formatCurrency($row['cost'])));
?>
<div class="button-group">
<button type="submit" value="<?php
echo $row['days'];
?>
" class="button" name="period">
<span><?php
echo $msg;
?>
</span>
</button>
</div>
<?php
示例15: array
// Verify user input for currency exists, is numeric, and as is a valid id
$billingCycle = $whmcs->get_req_var('billingcycle');
$currencyID = $whmcs->get_req_var('currency');
if (!is_numeric($currencyID)) {
$currency = array();
} else {
$currency = getCurrency('', $currencyID);
}
if (!$currency || !is_array($currency) || !isset($currency['id'])) {
$currency = getCurrency();
}
$currencyID = $currency['id'];
$result = select_query("tblpricing", "", array("type" => "product", "currency" => $currencyID, "relid" => $pid));
$data = mysql_fetch_array($result);
$price = $data[$billingCycle];
$price = formatCurrency($price);
widgetOutput($price);
} else {
widgetOutput('Invalid get option. Valid options are "name", "description", "configoption", "orderurl" or "price"');
}
/**
* The function to output the widget data to the browser in a javascript format.
*
* @throws WHMCS\Exception\ProgramExit
* @param string $value the data to output
*/
function widgetOutput($value)
{
echo "document.write('" . addslashes($value) . "');";
throw new ProgramExit();
}