本文整理汇总了PHP中price函数的典型用法代码示例。如果您正苦于以下问题:PHP price函数的具体用法?PHP price怎么用?PHP price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllProjectByStatus
/**
* Return all leads grouped by status
*
* @param int $limit Limit results
* @return array|int Array with value or -1 if error
* @throws Exception
*/
function getAllProjectByStatus($limit = 5)
{
global $conf, $user, $langs;
$datay = array ();
$sql = "SELECT";
$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= $this->buildWhere();
$sql .= " AND t.fk_opp_status = cls.rowid";
$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects
$sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label";
$result = array ();
$res = array ();
dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
$other = 0;
while ( $i < $num ) {
$row = $this->db->fetch_row($resql);
if ($i < $limit || $num == $limit)
{
$label = (($langs->trans("OppStatus".$row[2]) != "OppStatus".$row[2]) ? $langs->trans("OppStatus".$row[2]) : $row[2]);
$result[$i] = array(
$label. ' (' . price(price2num($row[0], 'MT'), 1, $langs, 1, -1, -1, $conf->currency) . ')',
$row[0]
);
}
else
$other += $row[1];
$i++;
}
if ($num > $limit)
$result[$i] = array (
$langs->transnoentitiesnoconv("Other"),
$other
);
$this->db->free($resql);
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR);
return -1;
}
return $result;
}
示例2: loadBox
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max of records to load
*
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$this->max = $max;
dol_include_once('/lead/class/lead.class.php');
$lead = new Lead($db);
$lead->fetch_all('DESC', 't.date_closure', $max, 0, array('t.date_closure<' => dol_now()));
$text = $langs->trans("LeadLate", $max);
$this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text));
$i = 0;
foreach ($lead->lines as $line) {
// FIXME: line is an array, not an object
$line->fetch_thirdparty();
// Ref
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $line->ref, 'url' => dol_buildpath('/lead/lead/card.php', 1) . '?id=' . $line->id);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($line->thirdparty->name, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $line->fk_soc);
// Amount Guess
$this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => price($line->amount_prosp, 'HTML') . $langs->getCurrencySymbol($conf->currency));
// Amount real
$this->info_box_contents[$i][5] = array('td' => 'align="left"', 'text' => $line->getRealAmount() . $langs->getCurrencySymbol($conf->currency));
$i++;
}
}
示例3: pt
function pt ($db, $sql, $date) {
global $bc;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0; $total = 0 ;
print "<TABLE border=\"1\" width=\"100%\">";
print "<TR class=\"liste_titre\">";
print "<TD width=\"60%\">$date</TD>";
print "<TD align=\"right\">Montant</TD>";
print "<td> </td>\n";
print "</TR>\n";
$var=True;
while ($i < $num) {
$obj = $db->fetch_object($result);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD>$obj->dm</TD>\n";
print "<TD align=\"right\">".price($obj->amount)."</TD><td> </td>\n";
print "</TR>\n";
$total = $total + $obj->amount;
$i++;
}
print "<tr><td align=\"right\">".$langs->trans("TotalHT").":</td><td align=\"right\"><b>".price($total)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>";
print "</table>";
$db->free();
}
}
示例4: pt
/**
* print function
*
* @param DoliDB $db Database
* @param string $sql sql
* @param string $date date
* @return void
*/
function pt($db, $sql, $date)
{
global $conf, $bc, $langs;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" width="60%">' . $date . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td> </td>' . "\n";
print "</tr>\n";
$var = True;
while ($i < $num) {
$obj = $db->fetch_object($result);
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td class="nowrap">' . $obj->dm . "</td>\n";
$total = $total + $obj->mm;
print '<td class="nowrap" align="right">' . price($obj->mm) . "</td><td > </td>\n";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td align="right">' . $langs->trans("Total") . " :</td><td class=\"nowrap\" align=\"right\"><b>" . price($total) . "</b></td><td> </td></tr>";
print "</table>";
$db->free($result);
} else {
dol_print_error($db);
}
}
示例5: ydf_excel
public function ydf_excel($date = NULL)
{
header("Content-Type: text/html; charset=gb2312");
if ($date == NULL) {
$date = date('Y-m-d');
}
$orders = $this->get_ydf_order($date);
$head = array('Sales Record Number', 'Buyer Fullname', 'Buyer Company', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Buyer Zip', 'Buyer Phone Number', 'Buyer Country', 'Custom Label', 'Description EN', 'Description CN', 'HS Code', 'Quantity', 'Sale Price', 'Country of Manufacture', 'Mark', 'weight', 'Length', 'Width', 'Height', 'Shipping Service', 'Shipping Service Name', 'Track Number');
foreach ($orders as $order) {
$skus = explode(',', $order->sku_str);
$qties = explode(',', $order->qty_str);
$shipping_method = shipping_method($order->is_register);
//echo $order->id."<br>";
$count = count($skus);
$product_name = '';
$product_name_en = '';
$qty = 0;
$weight = 0;
$rmb = price($this->order_model->calc_currency($order->currency, $order->gross));
for ($i = 0; $i < $count; $i++) {
if ($i == 0) {
$product_name .= iconv("UTF-8", "GB2312//IGNORE", get_product_name($skus[$i]));
$product_name_en .= iconv("UTF-8", "GB2312//IGNORE", get_product_name_en($skus[$i]));
}
$qty += $qties[$i];
$weight += get_weight_by_sku($skus[$i]) * $skus[$i];
}
$shipping_method_name_cn = iconv("UTF-8", "GB2312//IGNORE", $shipping_method->name_cn);
$data[] = array($order->id, $order->name, " ", $order->address_line_1, $order->address_line_2, $order->town_city, $order->state_province, $order->zip_code, $order->contact_phone_number, $order->country, $skus[0], $product_name_en, $product_name, " ", $qty, $rmb, " ", " ", $weight, " ", " ", " ", $shipping_method->ydf_code, $shipping_method_name_cn, $order->track_number);
}
$this->excel->array_to_excel($data, $head, 'ydf_list_' . $date);
}
示例6: toArray
public function toArray()
{
$results = [];
foreach ($this->getShipments() as $shipment) {
foreach ($this->getMethods($shipment->address) as $rate) {
$results[] = ['label' => $rate['title'] . ' - ' . price($rate['price']), 'name' => 'method', 'value' => $rate['code']];
}
}
return $results;
}
示例7: select_element
/**
* Build Select List of element associable to a businesscase
*
* @param string $tablename To parse
* @param Lead $lead The lead
* @param string $htmlname Name of the component
*
* @return string HTML select list of element
*/
function select_element($tablename, $lead, $htmlname = 'elementselect')
{
global $langs, $conf;
switch ($tablename) {
case "facture":
$sql = "SELECT rowid, facnumber as ref, total as total_ht, date_valid as date_element";
break;
case "contrat":
$sql = "SELECT rowid, ref as ref, 0 as total_ht, date_contrat as date_element";
break;
case "commande":
$sql = "SELECT rowid, ref as ref, total_ht as total_ht, date_commande as date_element";
break;
default:
$sql = "SELECT rowid, ref, total_ht, datep as date_element";
break;
}
$sql .= " FROM " . MAIN_DB_PREFIX . $tablename;
//TODO Fix sourcetype can be different from tablename (exemple project/projet)
$sql .= " WHERE rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='" . $lead->element . "' AND sourcetype='" . $tablename . "')";
// Manage filter
/*if (count($filter) > 0) {
foreach ( $filter as $key => $value ) {
if (($key == 's.fk_session_place') || ($key == 'f.rowid') || ($key == 's.type_session') || ($key == 's.status') || ($key == 'sale.fk_user_com')) {
$sql .= ' AND ' . $key . ' = ' . $value;
} else {
$sql .= ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
}*/
$sql .= " AND fk_soc=" . $lead->fk_soc;
$sql .= " AND entity=" . $conf->entity;
// $sql.= " AND entity IN (".getEntity($object->element,1).")";
$sql .= " ORDER BY ref DESC";
dol_syslog(get_class($this) . "::select_element sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
if ($num > 0) {
$sellist = '<select class="flat" name="' . $htmlname . '">';
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$sellist .= '<option value="' . $obj->rowid . '">' . $obj->ref . ' (' . dol_print_date($this->db->jdate($obj->date_element), 'daytextshort') . ')';
$sellist .= (empty($obj->total_ht) ? '' : '-' . price($obj->total_ht) . $langs->getCurrencySymbol($conf->currency)) . '</option>';
$i++;
}
$sellist .= '</select>';
}
return $sellist;
}
$this->db->free($resql);
return null;
}
示例8: _get_percent
function _get_percent($qty, $qty_used)
{
$percent = ($qty_used - $qty) / $qty * 100;
$color = '';
if ($percent > 0.5) {
$color = 'red';
} else {
if ($percent < -0.5) {
$color = 'orange';
}
}
return '<span style="color:' . $color . ';">' . price($percent, '', '', 1, 2, 2) . '%</span>';
}
示例9: _updateLine
function _updateLine($objectid, $objectelement, $lineid, $column, $value)
{
global $db, $conf, $langs;
${$column} = price2num($value);
$Tab = array();
$o = new $objectelement($db);
$o->fetch($objectid);
$find = false;
foreach ($o->lines as &$line) {
if ($line->id == $lineid || $line->rowid == $lineid) {
$find = true;
break;
}
}
if ($find) {
if (is_null($qty)) {
$qty = $line->qty;
}
if (is_null($price)) {
$price = $line->subprice;
}
if (is_null($remise_percent)) {
$remise_percent = $line->remise_percent;
}
if ($objectelement == 'facture') {
$res = $o->updateline($lineid, $line->desc, $price, $qty, $remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$total_ht = $o->line->total_ht;
$uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
} else {
if ($objectelement == 'commande') {
$res = $o->updateline($lineid, $line->desc, $price, $qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit);
$total_ht = $o->line->total_ht;
$uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
} else {
$res = $o->updateline($lineid, $price, $qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit);
$total_ht = $o->line->total_ht;
$uttc = $o->line->subprice + $o->line->subprice * $o->line->tva_tx / 100;
}
}
if ($res > 0) {
$Tab = array('total_ht' => price($total_ht), 'qty' => $qty, 'price' => price($price), 'remise_percent' => $remise_percent, 'uttc' => $uttc);
} else {
$Tab = array('error' => 'updateFailed', 'msg' => $o->error);
}
} else {
$Tab = array('error' => 'noline');
}
return $Tab;
}
示例10: voucher_summary
function voucher_summary($validity, $currency, $value)
{
if ($validity != 2 && $validity != '0') {
$return = '';
$return .= '<div class="row row-5">';
$return .= '<div class="col-xs-12"><p>Voucher</p></div>';
$return .= '<div class="col-xs-12">';
$return .= '<p class="amount">' . $currency . price(CURRENCY, $value) . '</p>';
$return .= '</div>';
$return .= '</div>';
} else {
$return = '';
}
echo $return;
}
示例11: voucher_summary
function voucher_summary($validity, $currency, $value)
{
if ($currency == 1) {
$currency = 'Rp.';
} else {
$currency = 'USD$';
}
if ($validity != 2 && $validity != '0') {
$return = '';
$return .= '<div class="col-sm-8"><p>Voucher</p></div>';
$return .= '<div class="col-sm-4">';
$return .= '<p class="amount">' . $currency . price(CURRENCY, $value) . '</p>';
$return .= '</div>';
} else {
$return = '';
}
echo $return;
}
示例12: update_payment_cost
public function update_payment_cost()
{
$id = $this->input->post('id');
$type = $this->input->post('type');
$value = trim($this->input->post('value'));
$item_cost = $this->purchase_finance_model->fetch_purchase_order($id)->item_cost;
$costs = $this->purchase_finance_model->fetch_payment_cost($id);
$payment_costs = isset($costs->payment_cost) ? $costs->payment_cost : '0';
$total_costs = price($payment_costs + $value);
try {
$payment_state = $this->purchase_finance_model->fetch_purchase_order($id)->payment_state;
if ($payment_state == 0) {
$skus_object = $this->purchase_order_model->fetch_all_sku_by_purchase_order_id($id);
foreach ($skus_object as $row) {
$count = on_way_count($row->sku);
$data_product = array('on_way_count' => $count);
$this->product_model->update_product_by_sku($row->sku, $data_product);
}
}
if (!is_numeric($value) || $value < 0) {
echo $this->create_json(0, lang('your_input_is_not_positive_numeric'), $value);
return;
}
if ($total_costs > $item_cost) {
echo $this->create_json(0, lang('your_input_is_not_range_numeric'), $value);
return;
} else {
// $completed_id = fetch_status_id('review_state', 'completed');
$data1 = array('purchase_order_id' => $id, 'payment_cost' => price($value));
if ($total_costs > 0 && $total_costs < $item_cost) {
$data = array('payment_state' => '2');
}
if ($total_costs == price($item_cost)) {
$data = array('payment_state' => '3');
}
$this->purchase_finance_model->add_purchase_payment($data1);
$this->purchase_order_model->review_reject_order($id, $data);
echo $this->create_json(1, lang('ok'), $value);
}
} catch (Exception $e) {
$this->ajax_failed();
echo lang('error_msg');
}
}
示例13: edit_save
public function edit_save()
{
$rules = array(array('field' => 'name_cn', 'label' => lang('chinese_name'), 'rules' => 'trim|required'), array('field' => 'name_en', 'label' => lang('english_name'), 'rules' => 'trim|required'), array('field' => 'image_url', 'label' => lang('image_url'), 'rules' => 'trim|is_url'), array('field' => 'length', 'label' => lang('length'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'width', 'label' => lang('width'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'height', 'label' => lang('height'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'weight', 'label' => lang('weight'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'content', 'label' => lang('content'), 'rules' => 'trim|required|positive_numeric'), array('field' => 'cost', 'label' => lang('packing_cost'), 'rules' => 'trim|required|positive_numeric'));
$this->form_validation->set_rules($rules);
if ($this->form_validation->run() == FALSE) {
$error = validation_errors();
echo $this->create_json(0, $error);
return;
}
$data = array('name_cn' => trim($this->input->post('name_cn')), 'name_en' => trim($this->input->post('name_en')), 'image_url' => trim($this->input->post('image_url')), 'length' => trim($this->input->post('length')), 'width' => trim($this->input->post('width')), 'height' => trim($this->input->post('height')), 'weight' => trim($this->input->post('weight')), 'content' => trim($this->input->post('content')), 'cost' => price(trim($this->input->post('cost'))));
try {
$id = $this->input->post('packing_id');
$this->product_packing_model->update_product_packing($id, $data);
echo $this->create_json(1, lang('product_packing_saved'));
} catch (Exception $e) {
echo lang('error_msg');
$this->ajax_failed();
}
}
示例14: pt
function pt ($db, $sql, $title) {
global $bc;
global $langs,$conf;
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print "<td>$title</td>";
print "<td align=\"right\">Montant</td>";
print "</tr>\n";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0; $total = 0 ;
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$obj->dm.'</td>';
print '<td align="right">'.price($obj->amount).'</td>';
print "</tr>\n";
$total = $total + $obj->amount;
$i++;
}
print "<tr class=\"total\"><td colspan=\"2\" align=\"right\"><b>".$langs->trans("TotalHT").": ".price($total)."</b> ".$langs->trans("Currency".$conf->monnaie)."</td></tr>";
$db->free();
}
else
{
dol_print_error($db);
}
print "</table>";
}
示例15: pt
function pt ($db, $sql, $date)
{
global $conf, $bc,$langs;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td nowrap width=\"60%\">$date</td>";
print "<td align=\"right\">".$langs->trans("Amount")."</td>";
print "<td> </td>\n";
print "</tr>\n";
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td nowrap>$obj->dm</td>\n";
$total = $total + $obj->mm;
print "<td nowrap align=\"right\">".price($obj->mm)."</td><td > </td>\n";
print "</tr>\n";
$i++;
}
print "<tr class=\"liste_total\"><td align=\"right\">".$langs->trans("Total")." :</td><td nowrap align=\"right\"><b>".price($total)."</b></td><td> </td></tr>";
print "</table>";
$db->free($result);
}
else {
dolibar_print_error($db);
}
}