• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Price类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fromJson

 public static function fromJson($json)
 {
     $r = new Price();
     $r->setGross($json->gross);
     $r->setCurrency($json->currency);
     return $r;
 }
开发者ID:purchased-at,项目名称:sdk-php,代码行数:7,代码来源:Price.php


示例2: testPricesWithNoTax

 public function testPricesWithNoTax()
 {
     $price = new Price(100, Price::NETTO, -1);
     $this->assertEquals(100, $price->convertTo(Price::NETTO));
     $this->assertEquals(100, $price->convertTo(Price::BRUTTO));
     $this->assertEquals(0, $price->convertTo(Price::TAX));
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:7,代码来源:PriceTest.php


示例3: import_csv

 protected function import_csv()
 {
     set_time_limit(0);
     $file_name = dirname(APPLICATION_PATH) . '/files/price.csv';
     if (file_exists($file_name)) {
         $Price = new Price();
         $f = fopen($file_name, 'r');
         echo getdate() . "<BR>";
         while (!feof($f)) {
             $s = fgets($f);
             $s = trim($s);
             if ($s != '') {
                 $ar = split(';', $s);
                 if ($ar[1] == '2') {
                     $data = array('id_product' => $ar[0], 'exists_type' => $ar[1], 'price' => $ar[2]);
                     if (!($er = $Price->add($data))) {
                         print_r($data);
                         print_r('error=' . $er);
                         exit;
                     }
                 }
             }
         }
         echo getdate();
         fclose($f);
     } else {
         echo 'file not found';
     }
 }
开发者ID:vitsun,项目名称:igrushki-detkam,代码行数:29,代码来源:ServicePriceController.php


示例4: Amount

 public function Amount($order)
 {
     $shopConfig = ShopConfig::current_shop_config();
     $amount = new Price();
     $amount->setAmount($order->SubTotal()->getAmount() * ($this->Rate / 100));
     $amount->setCurrency($shopConfig->BaseCurrency);
     $amount->setSymbol($shopConfig->BaseCurrencySymbol);
     return $amount;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe-flatfeetax,代码行数:9,代码来源:FlatFeeTaxRate.php


示例5: updateAmount

 /**
  * Choose Discounted price depending on current member's StreakDiscountType.
  *
  * @param Price $amount
  */
 public function updateAmount($amount)
 {
     // only if we are on a front-end page
     if (Controller::curr() instanceof Page_Controller) {
         if ($discountedPrice = $this->discountedPrice()) {
             $amount->setAmount($discountedPrice);
         }
     }
 }
开发者ID:swipestreak,项目名称:discounts,代码行数:14,代码来源:Discountable.php


示例6: testPayload

 public function testPayload()
 {
     $p = new Price();
     foreach ($this->payload as $testCase) {
         echo "Testing case: " . json_encode($testCase) . "\n";
         $p->setPricePerMinute($testCase["ppm"]);
         $this->assertEquals($p->calculateCallCost($testCase["duration"]), $testCase["result"]);
     }
 }
开发者ID:luizcapu,项目名称:scuptel,代码行数:9,代码来源:PriceTest.php


示例7: getPriceForDays

 public function getPriceForDays($days)
 {
     $price = Price::fromString('0', $this->price->getCurrency());
     while ($days > 0) {
         $days -= $this->unitInDays;
         $price = $price->add($this->price);
     }
     return $price;
 }
开发者ID:weblee,项目名称:equipment-rental,代码行数:9,代码来源:Rate.php


示例8: testCurrencyPairsConversions

 public function testCurrencyPairsConversions()
 {
     $price = new Price(array('EUR' => 5, 'USD' => 10, 'GBP' => 15), array('USD/CHF 1.500'));
     $conversions = $price->getConversions();
     $this->assertCount(1, $conversions);
     $this->assertInstanceOf('Money\\CurrencyPair', $conversions[0]);
     $this->assertEquals('USD', $conversions[0]->getBaseCurrency());
     $this->assertEquals('CHF', $conversions[0]->getCounterCurrency());
     $this->assertEquals(1.5, $conversions[0]->getRatio());
 }
开发者ID:leaphly,项目名称:price,代码行数:10,代码来源:ConversionPriceTest.php


示例9: Amount

 public function Amount()
 {
     // TODO: Multi currency
     $shopConfig = ShopConfig::current_shop_config();
     $amount = new Price();
     $amount->setAmount($this->Price);
     $amount->setCurrency($shopConfig->BaseCurrency);
     $amount->setSymbol($shopConfig->BaseCurrencySymbol);
     $this->extend('updateAmount', $amount);
     return $amount;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe-flatfeeshipping,代码行数:11,代码来源:FlatFeeShippingRate.php


示例10: testShouldBeImmutable

 public function testShouldBeImmutable()
 {
     $p1ArrayMoney = ['EUR' => 100, 'GBP' => 101];
     $p2ArrayMoney = ['EUR' => 100];
     $p2ArrayCurrency = ['EUR/GBP 1.100'];
     $price1 = new Price($p1ArrayMoney);
     $price2 = new Price($p2ArrayMoney, $p2ArrayCurrency);
     $priceAdd = $price1->add($price2);
     $priceMul = $price1->multiply(2);
     $this->assertEquals(new Price($p1ArrayMoney), $price1);
     $this->assertEquals(new Price($p2ArrayMoney, $p2ArrayCurrency), $price2);
 }
开发者ID:leaphly,项目名称:price,代码行数:12,代码来源:ConversionCoherencyTest.php


示例11: testPayload

 public function testPayload()
 {
     $price = new Price();
     $plan = new Plan();
     foreach ($this->payload as $testCase) {
         echo "Testing case: " . json_encode($testCase) . "\n";
         $price->setPricePerMinute($testCase["price"]["ppm"]);
         $plan->setMinutes($testCase["plan"]["min"]);
         $plan->setFareAdditionalMin($testCase["plan"]["fare"]);
         $this->assertEquals($plan->calculateCallCost($price, $testCase["duration"]), $testCase["result"]);
     }
 }
开发者ID:luizcapu,项目名称:scuptel,代码行数:12,代码来源:PlanTest.php


示例12: toObject

 private function toObject($row)
 {
     $obj = new Price();
     if (isset($row["from_ddd"])) {
         $obj->setFromDDD($row["from_ddd"]);
     }
     if (isset($row["to_ddd"])) {
         $obj->setToDDD($row["to_ddd"]);
     }
     if (isset($row["price_per_minute"])) {
         $obj->setPricePerMinute($row["price_per_minute"]);
     }
     return $obj;
 }
开发者ID:luizcapu,项目名称:scuptel,代码行数:14,代码来源:PriceDao.class.php


示例13: __construct

 public function __construct($controller, $name, $quantity = null, $redirectURL = null)
 {
     parent::__construct($controller, $name, FieldList::create(), FieldList::create(), null);
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript('swipestripe/javascript/ProductForm.js');
     $this->product = $controller->data();
     $this->quantity = $quantity;
     $this->redirectURL = $redirectURL;
     $this->fields = $this->createFields();
     $this->actions = $this->createActions();
     $this->validator = $this->createValidator();
     $this->setupFormErrors();
     $this->addExtraClass('product-form');
     //Add a map of all variations and prices to the page for updating the price
     $map = array();
     $variations = $this->product->Variations();
     $productPrice = $this->product->Price();
     if ($variations && $variations->exists()) {
         foreach ($variations as $variation) {
             if ($variation->isEnabled()) {
                 $variationPrice = $variation->Price();
                 $amount = Price::create();
                 $amount->setAmount($productPrice->getAmount() + $variationPrice->getAmount());
                 $amount->setCurrency($productPrice->getCurrency());
                 $amount->setSymbol($productPrice->getSymbol());
                 $map[] = array('price' => $amount->Nice(), 'options' => $variation->Options()->column('ID'), 'free' => _t('Product.FREE', 'Free'));
             }
         }
     }
     $this->setAttribute('data-map', json_encode($map));
 }
开发者ID:vinstah,项目名称:body,代码行数:32,代码来源:ProductForm.php


示例14: setList

 public static function setList($list)
 {
     $sql = 'UPDATE {{catalog}} SET available=0';
     DB::exec($sql);
     foreach ($list as $partname => $items) {
         $sql = 'SELECT tree FROM {{catalog}} WHERE partname="' . $partname . '"';
         $parent = DB::getOne($sql);
         if ($parent) {
             $available = 0;
             foreach ($items as $size => $item) {
                 $sql = 'SELECT id FROM {{tree}} WHERE parent=' . $parent . ' AND name="' . $size . '"';
                 $tree = DB::getOne($sql);
                 if (!$tree) {
                     $sql = 'SELECT id FROM {{tree}} WHERE parent=' . $parent . ' AND path="' . $size . '"';
                     $tree = DB::getOne($sql);
                 }
                 foreach ($item as $k => $f) {
                     $sql = 'SELECT type FROM {{fields}} WHERE module=6 AND path="' . $k . '"';
                     $r = DB::getOne($sql);
                     $row = array('field' => Fields::$types[$r]['type'], 'path' => $k, 'value' => $f);
                     Price::updateField($tree, $row);
                     if ($k == 'numberRetailSales' && $f > 0) {
                         $available = 1;
                     }
                 }
             }
             $sql = 'UPDATE {{catalog}} SET available=' . $available . ' WHERE tree=' . $parent;
             DB::exec($sql);
         }
     }
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:31,代码来源:PriceModel.php


示例15: getFormFields

 /**
  * Get the form fields for the OrderForm.
  * 
  * @return FieldList List of fields
  */
 public function getFormFields()
 {
     $fields = new FieldList();
     $field = new XeroTaxModifierField($this, _t('Xero.TAX', 'Tax'));
     $shopConfig = ShopConfig::current_shop_config();
     $amount = new Price();
     $amount->setAmount($this->Price);
     $amount->setCurrency($shopConfig->BaseCurrency);
     $amount->setSymbol($shopConfig->BaseCurrencySymbol);
     $field->setAmount($amount);
     $fields->push($field);
     if (!$fields->exists()) {
         Requirements::javascript('swipestripe-flatfeetax/javascript/FlatFeeTaxModifierField.js');
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe-xero,代码行数:21,代码来源:XeroTaxModification.php


示例16: run

 public function run()
 {
     Price::create(['min' => '0', 'max' => '1000000']);
     Price::create(['min' => '1000000', 'max' => '10000000']);
     Price::create(['min' => '10000000', 'max' => '100000000']);
     Price::create(['min' => '100000000']);
 }
开发者ID:trantung,项目名称:online_market,代码行数:7,代码来源:PriceTableSeeder.php


示例17: flush

 /**
  * 
  * @param Price $price
  * @return int id of the Price inserted in base. False if it didn't work.
  */
 public static function flush($price)
 {
     $priceId = $price->getId();
     $pricevar = $price->getPrice();
     if ($priceId > 0) {
         $sql = 'UPDATE price p SET ' . 'p.price = ?, ' . 'WHERE p.id_price = ?';
         $params = array('di', &$pricevar, $priceId);
     } else {
         $sql = 'INSERT INTO price ' . '(price) ' . 'VALUES(?) ';
         $params = array('d', &$pricevar);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $priceId > 0) {
         $idInsert = $priceId;
     }
     return $idInsert;
 }
开发者ID:Eurymone,项目名称:Student-Exam-Report-System,代码行数:22,代码来源:PriceDAL.php


示例18: addArrangementShortcode

 /**
  * Add the [recras-arrangement] shortcode
  *
  * @param array $attributes
  *
  * @return string
  */
 public static function addArrangementShortcode($attributes)
 {
     if (!isset($attributes['id'])) {
         return __('Error: no ID set', Plugin::TEXT_DOMAIN);
     }
     if (!ctype_digit($attributes['id'])) {
         return __('Error: ID is not a number', Plugin::TEXT_DOMAIN);
     }
     if (!isset($attributes['show'])) {
         return __('Error: "show" option not set', Plugin::TEXT_DOMAIN);
     }
     if (!in_array($attributes['show'], self::getValidOptions())) {
         return __('Error: invalid "show" option', Plugin::TEXT_DOMAIN);
     }
     $subdomain = Settings::getSubdomain($attributes);
     if (!$subdomain) {
         return Plugin::getNoSubdomainError();
     }
     $json = get_transient('recras_' . $subdomain . '_arrangement_' . $attributes['id']);
     if ($json === false) {
         try {
             $json = Http::get($subdomain, 'arrangementen/' . $attributes['id']);
         } catch (\Exception $e) {
             return $e->getMessage();
         }
         set_transient('recras_' . $subdomain . '_arrangement_' . $attributes['id'], $json, 86400);
     }
     switch ($attributes['show']) {
         case 'description':
             return $json->uitgebreide_beschrijving;
         case 'duration':
             return self::getDuration($json);
         case 'image_url':
             return $json->image_filename;
         case 'location':
             return self::getLocation($json);
         case 'persons':
             return '<span class="recras-persons">' . $json->aantal_personen . '</span>';
         case 'price_pp_excl_vat':
             return Price::format($json->prijs_pp_exc);
         case 'price_pp_incl_vat':
             return Price::format($json->prijs_pp_inc);
         case 'price_total_excl_vat':
             return Price::format($json->prijs_totaal_exc);
         case 'price_total_incl_vat':
             return Price::format($json->prijs_totaal_inc);
         case 'program':
         case 'programme':
             $startTime = isset($attributes['starttime']) ? $attributes['starttime'] : '00:00';
             $showHeader = !isset($attributes['showheader']) || Settings::parseBoolean($attributes['showheader']);
             return self::generateProgramme($json->programma, $startTime, $showHeader);
         case 'title':
             return '<span class="recras-title">' . $json->arrangement . '</span>';
         default:
             return __('Error: unknown option', Plugin::TEXT_DOMAIN);
     }
 }
开发者ID:recras,项目名称:recras-wordpress-plugin,代码行数:64,代码来源:Arrangement.php


示例19: label

 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return View::make('pc.search')->with(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
开发者ID:Jv-Juven,项目名称:gift,代码行数:9,代码来源:PcElectionController.php


示例20: label

 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return Response::json(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
开发者ID:Jv-Juven,项目名称:gift,代码行数:9,代码来源:ElectionPageController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Printer类代码示例发布时间:2022-05-23
下一篇:
PHP PrestaShopLogger类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap