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


PHP money函数代码示例

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


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

示例1: buy_product

 public function buy_product($id, $amount, $product, $user_id, $user_money)
 {
     //Market Update
     $this->db->set('amount', 'amount -' . $amount, FALSE);
     $this->db->where('id', $id);
     $this->db->update('market');
     //Company Update
     $this->db->select('money');
     $query = $this->db->get_where('companies', array('id' => $product->company_id), 1);
     if ($query->num_rows() === 1) {
         foreach ($query->result() as $company) {
         }
     } else {
         $return = NULL;
         log_message('error', 'function buy_product() in /megapublik/models/market_m.php has received bad data for $product->company_id.');
     }
     $company_money = unserialize($company->money);
     $currency_money = money($company_money, $product->currency);
     $new_money[$product->currency] = round($currency_money + $amount * $product->price, 2);
     $company_money = array_merge($company_money, $new_money);
     $this->db->set('money', serialize($company_money));
     $this->db->where('id', $product->company_id);
     $this->db->update('companies');
     //User Update
     $currency_money = money($user_money, $product->currency);
     $new_money[$product->currency] = round($currency_money - $amount * $product->price, 2);
     $user_money = array_merge($user_money, $new_money);
     $this->db->set('money', serialize($user_money));
     $this->db->where('id', $user_id);
     $this->db->update('users');
     log_message('debug', number_format($amount, 0, '.', ',') . ' products bought with type "' . $product->type . '" and price "' . number_format($product->price, 2, '.', ',') . ' ' . $product->currency . '" by user with ID "' . $user_id . '"');
     return TRUE;
 }
开发者ID:Razican,项目名称:MegaPublik,代码行数:33,代码来源:market_m.php

示例2: save_meta_box

function save_meta_box ($Customer) {
?>
<div id="misc-publishing-actions">
<p><strong><a href="<?php echo esc_url(add_query_arg(array('page'=>'ecart-orders','customer'=>$Customer->id),admin_url('admin.php'))); ?>"><?php _e('Orders','Ecart'); ?></a>: </strong><?php echo $Customer->orders; ?> &mdash; <strong><?php echo money($Customer->total); ?></strong></p>
<p><strong><a href="<?php echo esc_url( add_query_arg(array('page'=>'ecart-customers','range'=>'custom','start'=>date('n/j/Y',$Customer->created),'end'=>date('n/j/Y',$Customer->created)),admin_url('admin.php'))); ?>"><?php _e('Joined','Ecart'); ?></a>: </strong><?php echo date(get_option('date_format'),$Customer->created); ?></p>
<?php do_action('ecart_customer_editor_info',$Customer); ?>
</div>
<div id="major-publishing-actions">
	<input type="submit" class="button-primary" name="save" value="<?php _e('Save Changes','Ecart'); ?>" />
</div>
<?php
}
开发者ID:robbiespire,项目名称:paQui,代码行数:12,代码来源:ui.php

示例3: money

function money($boekhouding)
{
    if ($boekhouding["jaar"] <= $boekhouding["tijd"]) {
        $extra = floor($boekhouding["rente"] / 100 * $boekhouding["bigspending"]);
        $boekhouding["bigspending"] += $extra;
        $boekhouding["bkhdn"][$boekhouding["jaar"]] = "bedrag = " . $boekhouding["bigspending"] . "€ waaruit " . $extra . "€ de rente is";
        $boekhouding["jaar"]++;
        return money($boekhouding);
    } else {
        return $boekhouding;
    }
}
开发者ID:rubends,项目名称:web-backend-oplossingen,代码行数:12,代码来源:opdracht-functions-recursive2.php

示例4: money

function money($spending, $rente, $tijd)
{
    static $jaar = 1;
    static $boekhouding = array();
    //anders werkt het ni, static nog eens nachecken!
    if ($jaar <= $tijd) {
        $extra = floor($rente / 100 * $spending);
        $bigspending = $spending + $extra;
        $boekhouding[$jaar] = "bedrag = " . $bigspending . "€ waaruit " . $extra . "€ de rente is";
        $jaar++;
        //niet met tijd-- want dan hebt ge maar 50% vd antwoorden
        return money($bigspending, $rente, $tijd);
    } else {
        return $boekhouding;
    }
}
开发者ID:rubends,项目名称:web-backend-oplossingen,代码行数:16,代码来源:opdracht-functions-recursive1.php

示例5: setComparisonInfo

 public function setComparisonInfo($numItems, $cost)
 {
     global $overviewSavedDisplay;
     if ($this->numItems > $numItems) {
         throw new GetchabooksError("PriceSet::setComparisonInfo called with" . "inconsistent \$numItems.");
     } else {
         if ($this->numItems == $numItems) {
             $this->isComplete = true;
         } else {
             $this->isComplete = false;
         }
     }
     if ($cost) {
         $this->amountSaved = max(0, $cost - $this->total);
         $this->percentSaved = round(100 * $this->amountSaved / $cost, 0);
         if ($overviewSavedDisplay == 'percent') {
             $this->saved = $this->percentSaved . '%';
         } else {
             $this->saved = '$' . money($this->amountSaved);
         }
     } else {
         $this->saved = '';
     }
 }
开发者ID:therealchiko,项目名称:getchabooks,代码行数:24,代码来源:PriceSet.php

示例6: tag

	/**
	 * Provides support for the ecart('cartitem') tags
	 * 
	 * @since 1.1
	 *
	 * @return mixed
	 **/
	function tag ($id,$property,$options=array()) {
		global $Ecart;

		// Return strings with no options
		switch ($property) {
			case "id": return $id;
			case "product": return $this->product;
			case "name": return $this->name;
			case "type": return $this->type;
			case "link":
			case "url":
				return ecarturl(ECART_PRETTYURLS?$this->slug:array('ecart_pid'=>$this->product));
			case "sku": return $this->sku;
		}

		$taxes = isset($options['taxes'])?value_is_true($options['taxes']):null;
		if (in_array($property,array('price','newprice','unitprice','total','tax','options')))
			$taxes = ecart_taxrate($taxes,$this->taxable,$this) > 0?true:false;

		// Handle currency values
		$result = "";
		switch ($property) {
			case "discount": $result = (float)$this->discount; break;
			case "unitprice": $result = (float)$this->unitprice+($taxes?$this->unittax:0); break;
			case "unittax": $result = (float)$this->unittax; break;
			case "discounts": $result = (float)$this->discounts; break;
			case "tax": $result = (float)$this->tax; break;
			case "total": $result = (float)$this->total+($taxes?($this->unittax*$this->quantity):0); break;
		}
		if (is_float($result)) {
			if (isset($options['currency']) && !value_is_true($options['currency'])) return $result;
			else return money($result);
		}

		// Handle values with complex options
		switch ($property) {
			case "taxrate": return percentage($this->taxrate*100,array('precision' => 1)); break;
			case "quantity":
				$result = $this->quantity;
				if ($this->type == "Donation" && $this->donation['var'] == "on") return $result;
				if (isset($options['input']) && $options['input'] == "menu") {
					if (!isset($options['value'])) $options['value'] = $this->quantity;
					if (!isset($options['options']))
						$values = "1-15,20,25,30,35,40,45,50,60,70,80,90,100";
					else $values = $options['options'];

					if (strpos($values,",") !== false) $values = explode(",",$values);
					else $values = array($values);
					$qtys = array();
					foreach ($values as $value) {
						if (strpos($value,"-") !== false) {
							$value = explode("-",$value);
							if ($value[0] >= $value[1]) $qtys[] = $value[0];
							else for ($i = $value[0]; $i < $value[1]+1; $i++) $qtys[] = $i;
						} else $qtys[] = $value;
					}
					$result = '<select name="items['.$id.']['.$property.']">';
					foreach ($qtys as $qty)
						$result .= '<option'.(($qty == $this->quantity)?' selected="selected"':'').' value="'.$qty.'">'.$qty.'</option>';
					$result .= '</select>';
				} elseif (isset($options['input']) && valid_input($options['input'])) {
					if (!isset($options['size'])) $options['size'] = 5;
					if (!isset($options['value'])) $options['value'] = $this->quantity;
					$result = '<input type="'.$options['input'].'" name="items['.$id.']['.$property.']" id="items-'.$id.'-'.$property.'" '.inputattrs($options).'/>';
				} else $result = $this->quantity;
				break;
			case "remove":
				$label = __("Remove");
				if (isset($options['label'])) $label = $options['label'];
				if (isset($options['class'])) $class = ' class="'.$options['class'].'"';
				else $class = ' class="remove"';
				if (isset($options['input'])) {
					switch ($options['input']) {
						case "button":
							$result = '<button type="submit" name="remove['.$id.']" value="'.$id.'"'.$class.' tabindex="">'.$label.'</button>'; break;
						case "checkbox":
						    $result = '<input type="checkbox" name="remove['.$id.']" value="'.$id.'"'.$class.' tabindex="" title="'.$label.'"/>'; break;
					}
				} else {
					$result = '<a href="'.href_add_query_arg(array('cart'=>'update','item'=>$id,'quantity'=>0),ecarturl(false,'cart')).'"'.$class.'>'.$label.'</a>';
				}
				break;
			case "optionlabel": $result = $this->option->label; break;
			case "options":
				$class = "";
				if (!isset($options['before'])) $options['before'] = '';
				if (!isset($options['after'])) $options['after'] = '';
				if (isset($options['show']) &&
					strtolower($options['show']) == "selected")
					return (!empty($this->option->label))?
						$options['before'].$this->option->label.$options['after']:'';

				if (isset($options['class'])) $class = ' class="'.$options['class'].'" ';
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Item.php

示例7: output_message

                 }
             }
         }
     }
 } else {
     if ($action == 'changesex') {
         if (!$config['chars_changesex_enable']) {
             output_message('alert', 'Смена пола персонажей запрещена!' . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
         } else {
             if ($timediffh < $config['chars_changesex_hdiff'] and !$isadmin) {
                 $timenext = $timeaction + 3600 * $config['chars_changesex_hdiff'];
                 $timenextf = date('Y-m-d H:i:s', $timenext);
                 output_message('alert', 'Слишком часто меняете пол! <br /> Следующая смена возможна: ' . $timenextf . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
             } else {
                 if ($my_char->money < $config['chars_changesex_cost'] and !$isadmin) {
                     output_message('alert', 'Недостаточно средств для смены пола персонажа!<br />Есть: ' . money($my_char->money) . '<br />Нужно: ' . money($config['chars_rename_cost']) . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
                 } else {
                     $WSDB->query("INSERT INTO `mwfe3_character_actions` \n                                (`guid`, `account`, `action`, `timeaction`, `data`) \n                                VALUES\n                                (?d,?d,?,?,?);", $my_char->guid, $user['id'], $action, $timecurrf, $my_char->sqlinfo['data']);
                     $my_char->ChangeGender($mangos_field, $char_models);
                     $my_char->MoneyAdd(-$config['chars_changesex_cost'], $mangos_field);
                     $WSDB->query("UPDATE `characters` SET ?a WHERE account=?d and `guid`=?d LIMIT 1", $my_char->sqlinfo, $user['id'], $my_char->guid);
                     output_message('notice', 'Операция по смене пола прошла успешно!' . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
                 }
             }
         }
     } else {
         if ($action == 'changesexfix') {
             $WSDB->query("INSERT INTO `mwfe3_character_actions` \n                      (`guid`, `account`, `action`, `timeaction`, `data`) \n                        VALUES\n                      (?d,?d,?,?,?);", $my_char->guid, $user['id'], $action, $timecurrf, $my_char->sqlinfo['data']);
             $my_char->ChangeGenderFix($mangos_field, $char_models);
             $WSDB->query("UPDATE `characters` SET `data`=?a WHERE account=?d and `guid`=?d LIMIT 1", $my_char->sqlinfo, $user['id'], $my_char->guid);
             output_message('notice', 'Фикс после смены пола персонажа выполнен успешно!' . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
开发者ID:space77,项目名称:mwfv3_sp,代码行数:31,代码来源:account.chars.php

示例8: array

            $debt = array();
            $debt['amount_to_pay'] = money($row['DebtInfo']['attr']['amountToPay']);
            $debt['debt'] = money($row['DebtInfo']['attr']['debt']);
            $debt['service_name'] = isset($row['ServiceName']['value']) ? $row['ServiceName']['value'] : '';
            $debt['service_code'] = isset($row['attr']['serviceCode']) ? $row['attr']['serviceCode'] : '';
            $debt['service_price'] = isset($row['attr']['metersGlobalTarif']) ? money($row['attr']['metersGlobalTarif']) : '';
            $debt['destination'] = isset($row['Destination']['value']) ? $row['Destination']['value'] : '';
            $debt['num'] = $row['PayerInfo']['attr']['ls'];
            $debt['year'] = $row['DebtInfo']['Year']['value'];
            $debt['month'] = $row['DebtInfo']['Month']['value'];
            $debt['charge'] = money($row['DebtInfo']['Charge']['value']);
            $debt['balance'] = money($row['DebtInfo']['Balance']['value']);
            $debt['recalc'] = money($row['DebtInfo']['Recalc']['value']);
            $debt['subsidies'] = money($row['DebtInfo']['Subsidies']['value']);
            $debt['remission'] = money($row['DebtInfo']['Remission']['value']);
            $debt['lastPaying'] = money($row['DebtInfo']['LastPaying']['value']);
            $debt['company_name'] = $row['CompanyInfo']['CompanyName']['value'];
            $debt['company_mfo'] = isset($row['CompanyInfo']['attr']['mfo']) ? $row['CompanyInfo']['attr']['mfo'] : '';
            $debt['company_okpo'] = isset($row['CompanyInfo']['attr']['okpo']) ? $row['CompanyInfo']['attr']['okpo'] : '';
            $debt['company_accnt'] = isset($row['CompanyInfo']['attr']['account']) ? $row['CompanyInfo']['attr']['account'] : '';
            $debts[] = $debt;
            $services[$debt['service_code']] = $debt;
        }
        $_SESSION['services'] = $services;
        $smarty->assign('debts', $debts);
        $smarty->assign('payer_info', $payerInfo);
    }
}
$gs = isset($_GET['search']) ? $_GET['search'] : '';
$smarty->assign('error_msg', $errorMessage);
$smarty->assign('search', $search);
开发者ID:vPolyovyj,项目名称:pb_payer,代码行数:31,代码来源:search.php

示例9: cny

    ?>
</td>
                        <td><?php 
    echo cny($v->normal_return_profit_volume);
    ?>
</td>
                        <td><?php 
    echo cny($v->invite_return_profit_volume);
    ?>
</td>
                        <!--<td><?php 
    //=cny($v->delay_return_profit_volume);
    ?>
</td>-->
                        <td>¥<?php 
    echo bcadd(bcadd(money($v->normal_return_profit_volume), 0, 2), money($v->invite_return_profit_volume), 2);
    ?>
</td>
                        <td><?php 
    echo $v->order_quantity;
    ?>
</td>
                    </tr>
                <?php 
}
?>
            </table>
            <div class="page"><?php 
echo $page;
?>
</div>
开发者ID:Princelo,项目名称:bioerp,代码行数:31,代码来源:listpage_year_admin.php

示例10: in_array

        $location .= $Customer->state;
        if (!empty($location) && !empty($Customer->country)) {
            $location .= ' &mdash; ';
        }
        $location .= $Customer->country;
        echo $location;
        ?>
</td>
			<td class="total column-total<?php 
        echo in_array('total', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        echo $Customer->orders;
        ?>
 &mdash; <?php 
        echo money($Customer->total);
        ?>
</td>
			<td class="date column-date<?php 
        echo in_array('date', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        echo date("Y/m/d", mktimestamp($Customer->created));
        ?>
</td>
		</tr>
		<?php 
    }
    ?>
		</tbody>
	<?php 
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:31,代码来源:customers.php

示例11: addons_list

 /**
  * Displays all of the product addons for the cart item in an unordered list
  *
  * @api `shopp('cartitem.addons-list')`
  * @since 1.1
  *
  * @param string        $result  The output
  * @param array         $options The options
  * - **before**: ` ` Markup to add before the list
  * - **after**: ` ` Markup to add after the list
  * - **class**: The class attribute specifies one or more class-names for the list
  * - **exclude**: Used to specify addon labels to exclude from the list. Multiple addons can be excluded by separating them with a comma: `Addon Label 1,Addon Label 2...`
  * - **separator**: `: ` The separator to use between the menu name and the addon options
  * - **prices**: `on` (on, off) Shows or hides prices with the addon label
  * - **taxes**: `on` (on, off) Include taxes in the addon option price shown when `prices=on`
  * @param ShoppCartItem $O       The working object
  * @return string The addon list markup
  **/
 public static function addons_list($result, $options, $O)
 {
     if (empty($O->addons)) {
         return false;
     }
     $defaults = array('before' => '', 'after' => '', 'class' => '', 'exclude' => '', 'separator' => ': ', 'prices' => true, 'taxes' => shopp_setting('tax_inclusive'));
     $options = array_merge($defaults, $options);
     extract($options);
     $classes = !empty($class) ? ' class="' . esc_attr($class) . '"' : '';
     $excludes = explode(',', $exclude);
     $prices = Shopp::str_true($prices);
     $taxes = Shopp::str_true($taxes);
     // Get the menu labels list and addon options to menus map
     list($menus, $menumap) = self::_addon_menus();
     $result .= $before . '<ul' . $classes . '>';
     foreach ($O->addons as $id => $addon) {
         if (in_array($addon->label, $excludes)) {
             continue;
         }
         $menu = isset($menumap[$addon->options]) ? $menus[$menumap[$addon->options]] . $separator : false;
         $price = Shopp::str_true($addon->sale) ? $addon->promoprice : $addon->price;
         if ($taxes && $O->taxrate > 0) {
             $price = $price + $price * $O->taxrate;
         }
         if ($prices) {
             $pricing = " (" . ($addon->price < 0 ? '-' : '+') . money($price) . ')';
         }
         $result .= '<li>' . $menu . $addon->label . $pricing . '</li>';
     }
     $result .= '</ul>' . $after;
     return $result;
 }
开发者ID:crunnells,项目名称:shopp,代码行数:50,代码来源:cartitem.php

示例12: tag

	function tag ($property,$options=array()) {
		global $Ecart;

		$select_attrs = array('title','required','class','disabled','required','size','tabindex','accesskey');
		$submit_attrs = array('title','class','value','disabled','tabindex','accesskey');

		switch ($property) {
			case "link":
			case "url":
				return ecarturl(ECART_PRETTYURLS?$this->slug:array('ecart_pid'=>$this->id));
				break;
			case "found":
				if (empty($this->id)) return false;
				$load = array('prices','images','specs','tags','categories');
				if (isset($options['load'])) $load = explode(",",$options['load']);
				$this->load_data($load);
				return true;
				break;
			case "relevance": return (string)$this->score; break;
			case "id": return $this->id; break;
			case "name": return apply_filters('ecart_product_name',$this->name); break;
			case "slug": return $this->slug; break;
			case "summary": return apply_filters('ecart_product_summary',$this->summary); break;
			case "description":
				return apply_filters('ecart_product_description',$this->description);
			case "isfeatured":
			case "is-featured":
				return ($this->featured == "on"); break;
			case "price":
			case "saleprice":
				if (empty($this->prices)) $this->load_data(array('prices'));
				$defaults = array(
					'taxes' => null,
					'starting' => ''
				);
				$options = array_merge($defaults,$options);
				extract($options);

				if (!is_null($taxes)) $taxes = value_is_true($taxes);

				$min = $this->min[$property];
				$mintax = $this->min[$property.'_tax'];

				$max = $this->max[$property];
				$maxtax = $this->max[$property.'_tax'];

				$taxrate = ecart_taxrate($taxes,$this->prices[0]->tax,$this);

				if ("saleprice" == $property) $pricetag = $this->prices[0]->promoprice;
				else $pricetag = $this->prices[0]->price;

				if (count($this->options) > 0) {
					$taxrate = ecart_taxrate($taxes,true,$this);
					$mintax = $mintax?$min*$taxrate:0;
					$maxtax = $maxtax?$max*$taxrate:0;

					if ($min == $max) return money($min+$mintax);
					else {
						if (!empty($starting)) return "$starting ".money($min+$mintax);
						return money($min+$mintax)." &mdash; ".money($max+$maxtax);
					}
				} else return money($pricetag+($pricetag*$taxrate));

				break;
			case "taxrate":
				return ecart_taxrate(null,true,$this);
				break;
			case "weight":
				if(empty($this->prices)) $this->load_data(array('prices'));
				$defaults = array(
					'unit' => $Ecart->Settings->get('weight_unit'),
					'min' => $this->min['weight'],
					'max' => $this->max['weight'],
					'units' => true,
					'convert' => false
				);
				$options = array_merge($defaults,$options);
				extract($options);

				if(!isset($this->min['weight'])) return false;

				if ($convert !== false) {
					$min = convert_unit($min,$convert);
					$max = convert_unit($max,$convert);
					if (is_null($units)) $units = true;
					$unit = $convert;
				}

				$range = false;
				if ($min != $max) {
					$range = array($min,$max);
					sort($range);
				}

				$string = ($min == $max)?round($min,3):round($range[0],3)." - ".round($range[1],3);
				$string .= value_is_true($units) ? " $unit" : "";
				return $string;
				break;
			case "onsale":
				if (empty($this->prices)) $this->load_data(array('prices'));
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Product.php

示例13: getCashToPay

 function getCashToPay()
 {
     $tariffPrice = $this->calculateTariffPrice();
     $cash = money($this->data['cash']);
     $cashToPay = $tariffPrice - $cash;
     return smoneyf($cashToPay);
 }
开发者ID:carriercomm,项目名称:Nuance,代码行数:7,代码来源:ucp.php

示例14: download_xls

 public function download_xls()
 {
     $report_type = $this->input->post('report_type');
     $date_from = $this->input->post('date_from');
     $date_to = $this->input->post('date_to');
     if ($report_type != '' && $date_from != '' && $date_to != '') {
         $this->load->library('PHPExcel');
         $objPHPExcel = new PHPExcel();
         $title = "untitled";
         switch ($report_type) {
             case 'day':
                 $title = "ERP 日报表 {$date_from} - {$date_to}";
                 $bills = $this->Mbill->objGetZentsBillsOfDay($date_from, $date_to);
                 break;
             case 'month':
                 $bills = $this->Mbill->objGetZentsBillsOfMonth($date_from, $date_to);
                 $date_from = date('Y-m', strtotime($date_from));
                 $date_to = date('Y-m', strtotime($date_to));
                 $title = "ERP 月报表 {$date_from} - {$date_to}";
                 break;
             case 'year':
                 $bills = $this->Mbill->objGetZentsBillsOfYear($date_from, $date_to);
                 $date_from = date('Y', strtotime($date_from));
                 $date_to = date('Y', strtotime($date_to));
                 $title = "ERP 年报表 {$date_from} - {$date_to}";
                 break;
             case 'products':
                 $bills = $this->Mbill->objGetProductBills($date_from, $date_to);
                 $title = "ERP 产品报表 {$date_from} - {$date_to}";
                 break;
             case 'users':
                 $bills = $this->Mbill->objGetUserBills($date_from, $date_to);
                 $title = "ERP 代理交易统计报表 {$date_from} - {$date_to}";
                 break;
             default:
                 break;
         }
         // Set document properties
         $objPHPExcel->getProperties()->setCreator("Princelo Lamkimcheung@gmail.com")->setLastModifiedBy("Princelo Lamkimcheung@gmail.com")->setTitle($title)->setSubject($title)->setDescription($title)->setKeywords("Princelo lamkimcheung@gmail.com")->setCategory($report_type);
         if ($report_type == 'products') {
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $title)->setCellValue('A2', '产品ID')->setCellValue('B2', '产品名称')->setCellValue('C2', '出货量')->setCellValue('D2', '总金额');
             foreach ($bills as $k => $v) {
                 $i = $k + 3;
                 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $v->product_id)->setCellValue("B{$i}", $v->title)->setCellValue("C{$i}", $v->total_quantity)->setCellValue("D{$i}", $v->amount);
             }
         } elseif ($report_type == 'users') {
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $title)->setCellValue('A2', '代理')->setCellValue('B2', '业绩增量')->setCellValue('C2', '自下级(下下级)收益增量(不含推荐)')->setCellValue('D2', '自下级推荐收益增量')->setCellValue('E2', '总收益增量')->setCellValue('F2', '至推荐人收益')->setCellValue('G2', '至推荐人推荐收益')->setCellValue('H2', '至推荐人总收益')->setCellValue('I2', '至跨界推荐人收益')->setCellValue('J2', '推荐人代理')->setCellValue('K2', '跨界推荐人代理');
             foreach ($bills as $k => $v) {
                 $i = $k + 3;
                 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $v->name . "(" . $v->username . "/" . $v->id . ")")->setCellValue("B{$i}", cny($v->turnover))->setCellValue("C{$i}", cny($v->normal_return_profit_sub2self))->setCellValue("D{$i}", cny($v->extra_return_profit_sub2self))->setCellValue("E{$i}", '¥' . bcadd(bcadd(money($v->normal_return_profit_sub2self), money($v->extra_return_profit_sub2self), 2), 0, 2))->setCellValue("F{$i}", cny($v->normal_return_profit_self2parent))->setCellValue("G{$i}", cny($v->extra_return_profit_self2parent))->setCellValue("H{$i}", "¥" . bcadd(money($v->normal_return_profit_self2parent), money($v->extra_return_profit_self2parent), 2))->setCellValue("I{$i}", cny($v->normal_return_profit_self2gparent));
                 if (intval($v->pid) > 0) {
                     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("J{$i}", $v->pname . "(" . $v->pusername . "/" . $v->pid . ")");
                 } else {
                     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("J{$i}", "无推荐人");
                 }
                 if (intval($v->gpid) > 0) {
                     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("K{$i}", $v->gpname . "(" . $v->gpusername . "/" . $v->gpid . ")");
                 } else {
                     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("K{$i}", "无跨界推荐人");
                 }
             }
         } else {
             // Add some data
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $title)->setCellValue('A2', '日期')->setCellValue('B2', '总金额(含运费)')->setCellValue('C2', '产品总金额')->setCellValue('D2', '运费总金额')->setCellValue('E2', '即时收益总量')->setCellValue('F2', '收益总量')->setCellValue('G2', '订单数');
             // Miscellaneous glyphs, UTF-8
             foreach ($bills as $k => $v) {
                 $i = $k + 3;
                 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $v->date)->setCellValue("B{$i}", $v->total_volume)->setCellValue("C{$i}", $v->products_volume)->setCellValue("D{$i}", $v->post_fee)->setCellValue("E{$i}", $v->normal_return_profit_volume)->setCellValue("F{$i}", "¥" . bcadd(money($v->normal_return_profit_volume), 0, 2))->setCellValue("G{$i}", $v->order_quantity);
             }
         }
         // Rename worksheet
         $objPHPExcel->getActiveSheet()->setTitle('REPORT');
         // Set active sheet index to the first sheet, so Excel opens this as the first sheet
         $objPHPExcel->setActiveSheetIndex(0);
         // Redirect output to a client’s web browser (Excel5)
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="' . $title . '.xls"');
         header('Cache-Control: max-age=0');
         // If you're serving to IE 9, then the following may be needed
         header('Cache-Control: max-age=1');
         // If you're serving to IE over SSL, then the following may be needed
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         // always modified
         header('Cache-Control: cache, must-revalidate');
         // HTTP/1.1
         header('Pragma: public');
         // HTTP/1.0
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
         $objWriter->save('php://output');
         exit;
     } else {
         exit('This page is expired !');
     }
 }
开发者ID:Princelo,项目名称:bioerp,代码行数:96,代码来源:Report.php

示例15: in_array

        if (!empty($location) && !empty($Order->shipstate)) {
            $location .= ', ';
        }
        $location .= $Order->shipstate;
        if (!empty($location) && !empty($Order->shipcountry)) {
            $location .= ' &mdash; ';
        }
        $location .= $Order->shipcountry;
        echo $location;
        ?>
</td>
			<td class="total column-total<?php 
        echo in_array('total', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        echo money($Order->total);
        ?>
</td>
			<td class="txn column-txn<?php 
        echo in_array('txn', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        echo $Order->transactionid;
        ?>
<br /><strong><?php 
        echo $Order->gateway;
        ?>
</strong> &mdash; <?php 
        echo $txnstatus;
        ?>
</td>
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:31,代码来源:orders.php


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