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

PHP models\Currency类代码示例

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

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



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

示例1: globalData

 /**
  * Prepare global variables.
  * @return array
  */
 public static function globalData()
 {
     if (!Auth::check()) {
         $rows = null;
         $cart = null;
         $grandTotal = null;
     } else {
         $rows = Cart::instance(auth()->id())->count(false);
         $cart = Cart::instance(auth()->id())->content();
         $grandTotal = Cart::instance(auth()->id())->total();
     }
     $data = array('menu' => self::getMenuData(self::$parent_id), 'header' => Setting::findOrFail(1), 'rows' => $rows, 'cart' => $cart, 'grand_total' => $grandTotal, 'currencies' => Currency::all());
     return $data;
 }
开发者ID:raylight75,项目名称:cms,代码行数:18,代码来源:GlobalComposer.php


示例2: fakeCurrency

 protected function fakeCurrency()
 {
     $fakeCurrency = new Currency();
     $fakeCurrency->currency_code = "USD";
     $fakeCurrency->currency_name = "Dollar";
     $fakeCurrency->save();
     return $fakeCurrency;
 }
开发者ID:boylee1111,项目名称:Reservation,代码行数:8,代码来源:DbTestCase.php


示例3: __construct

 public function __construct(Currency $currencyModel, Note $noteModel)
 {
     $notes = $noteModel->getLastNote();
     if (count($notes) < 1) {
         $notes = false;
     }
     //GLOBAL SETTINGS
     $this->_glob = array('_note' => $notes, '_curr' => $currencyModel->getRate(), '_baseCurrency' => 'RUB', '_precision' => 2, '_countProductsOfPage' => Auth::User() ? Auth::User()->count_products : 100, '_maxCountProductsOfPage' => 500, '_alerts' => AbsentController::shortView());
     View::share('_glob', $this->_glob);
 }
开发者ID:enotsokolov,项目名称:vp_plus,代码行数:10,代码来源:Controller.php


示例4: initCurrenciesToDb

 private function initCurrenciesToDb()
 {
     for ($day = 3000; $day > 0; $day--) {
         $currency = new Currency();
         $date = date('Y-m-d', strtotime('-' . $day . ' day'));
         $currency->date = $date;
         $currency->usd = $this->getCurrencyForDate($date);
         $currency->save();
         echo $day . PHP_EOL;
     }
 }
开发者ID:sasik-github,项目名称:currency,代码行数:11,代码来源:MyCommand.php


示例5: actionGetCurrencies

 public function actionGetCurrencies()
 {
     $billing_id = Yii::$app->request->post('billing_id');
     $currencies = ArrayHelper::map(Currency::find()->where("billing_id = :billing_id", [':billing_id' => $billing_id])->with('billing')->asArray()->all(), 'id', 'name');
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return $currencies;
 }
开发者ID:zinchenkomax,项目名称:moneychanger,代码行数:7,代码来源:RateController.php


示例6: show

 /**
  * Change the currency.
  *
  * @return Redirect
  */
 public function show(Request $request, string $currency)
 {
     $request->session()->put('currency', $currency);
     $currency = Currency::where('currency', $currency)->first()->toArray();
     $request->session()->put('currency_rate', $currency['rate']);
     // we need to update the basket
     $basket = $request->session()->get('basket');
     foreach ($basket['items'] as $id => $item) {
         if (isset($item['parent_sku'])) {
             // its an option
             $product = Product::where('sku', $item['parent_sku'])->first();
             $price = isset($product->salePrice) && !empty($product->salePrice) ? $product->salePrice : $product->price;
             foreach ($product->option_values as $option) {
                 if ($option['sku'] == $id) {
                     $price = number_format($option['price'] * $request->session()->get('currency_rate'), 2, '.', '');
                 }
             }
         } else {
             $product = Product::find($id);
             $price = isset($product->salePrice) && !empty($product->salePrice) ? $product->salePrice : $product->price;
         }
         $basket['items'][$id]['price'] = $price;
     }
     $request->session()->put('basket', $basket);
     return redirect()->back();
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:31,代码来源:CurrenciesController.php


示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('course')->delete();
     Model::unguard();
     $faker = Faker\Factory::create();
     $currencies = Currency::all()->toArray();
     DB::table('course')->insert([['currency_id' => $currencies[0]['id'], 'course_purchase' => 5.4, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[1]['id'], 'course_purchase' => 5.0, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[2]['id'], 'course_purchase' => 1.03, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[3]['id'], 'course_purchase' => 1.7, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[4]['id'], 'course_purchase' => 1.7, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[5]['id'], 'course_purchase' => 1.0, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[6]['id'], 'course_purchase' => 0.1, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[7]['id'], 'course_purchase' => 0.3, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[8]['id'], 'course_purchase' => 0.1, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[9]['id'], 'course_purchase' => 0.00014, 'wallet' => $faker->creditCardNumber], ['currency_id' => $currencies[10]['id'], 'course_purchase' => 0.0, 'wallet' => $faker->creditCardNumber]]);
     Model::reguard();
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:14,代码来源:CourseTableSeeder.php


示例8: exchangeRates

 public function exchangeRates()
 {
     $currency = new Currency();
     $url = 'https://api.privatbank.ua/p24api/pubinfo?exchange&coursid=3';
     $xml = new SimpleXMLElement($url, NULL, true);
     $eur = (array) $xml->row[0]->exchangerate['sale'];
     $rur = (array) $xml->row[1]->exchangerate['sale'];
     $usd = (array) $xml->row[2]->exchangerate['sale'];
     $currency->uan = 1;
     $currency->eur = $eur[0];
     $currency->rur = $rur[0];
     $currency->usd = $usd[0];
     $currency->date = 86400 * ceil(time() / 86400);
     if ($currency->save()) {
         return false;
     }
     return true;
 }
开发者ID:aiskimzhi,项目名称:advert,代码行数:18,代码来源:Currency.php


示例9: getActiveCurrency

 public static function getActiveCurrency($chCode = false)
 {
     $attr = 'name';
     $query = Currency::find()->andWhere(['active' => true])->all();
     if ($chCode) {
         $attr = 'chCode';
     }
     return ArrayHelper::map($query, 'id', $attr);
 }
开发者ID:alexus007,项目名称:budget,代码行数:9,代码来源:Currency.php


示例10: actionUpdate

 /**
  * Updates an existing Rate model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         $currency_list = Currency::getCurrencyList();
         return $this->render('update', ['model' => $model, 'currency' => $currency_list]);
     }
 }
开发者ID:zinchenkomax,项目名称:moneychanger,代码行数:16,代码来源:RateController.php


示例11: currency

 /**
  *
  * Helper Currency Class
  *
  * @package ecommerce-cms
  * @category Helper Class
  * @author Tihomir Blazhev <[email protected]>
  * @link https://[email protected]/raylight75/ecommerce-cms.git
  */
 public static function currency($input)
 {
     $var = session('currency');
     if (isset($var)) {
         $currency = Currency::where('name', '=', $var)->first();
         $rate = $currency->rate;
     } else {
         $rate = 1;
     }
     $total = (double) $input * (double) $rate;
     return number_format((double) $total, 2);
 }
开发者ID:raylight75,项目名称:cms,代码行数:21,代码来源:Helper.php


示例12: actionCreate

 /**
  * Creates a new Account model.
  * If creation is successful, the browser will be redirected to the 'index' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Account();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash("Account-success", Yii::t("app", "Account successfully created"));
         return $this->redirect(['index']);
     } else {
         $currencyItems = Currency::find()->select(['id', 'name'])->where(['user_id' => Yii::$app->user->id])->asArray()->all();
         $currencyItems = ArrayHelper::map($currencyItems, 'id', 'name');
         return $this->render('create', ['model' => $model, 'currencyItems' => $currencyItems]);
     }
 }
开发者ID:ercling,项目名称:economizzer,代码行数:17,代码来源:AccountController.php


示例13: postSetActive

 public function postSetActive()
 {
     $id = Input::get('id');
     Currency::where('active', 1)->update(['active' => 0]);
     $currency = Currency::find($id);
     if ($currency) {
         $currency->active = 1;
         $currency->save();
         return Redirect::back()->with('message', "Курс валюты '{$currency->title}' обновлён");
     }
     return Redirect::back()->with('message', 'Ошибка обновления');
 }
开发者ID:venomir,项目名称:tc,代码行数:12,代码来源:CurrencyController.php


示例14: price

 public function price()
 {
     $active_currency = Currency::active();
     $price = $this->price * $active_currency->rate_ue * $active_currency->rate_rub;
     if ($this->is_default_discount > 0) {
         $default_discount_sum = $price / 100 * $this->default_discount;
         $price -= $default_discount_sum;
     }
     if (Auth::check()) {
         $price -= $this->personal_discount($price);
     }
     return $price;
 }
开发者ID:venomir,项目名称:tc,代码行数:13,代码来源:Product.php


示例15: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Currency::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'iso', $this->iso])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:Nhassa,项目名称:budget,代码行数:21,代码来源:CurrencySearch.php


示例16: __construct

 public function __construct(Route $route)
 {
     $this->middleware(function ($request, $next) {
         // if session is not set get it from .env SHOP_CODE
         if (!$request->session()->has('shop')) {
             $shop = Shop::where('code', config('app.shop_code'))->first();
             $request->session()->put('shop', $shop->id);
         }
         // if limit is not set default pagination limit
         if (!$request->session()->has('limit')) {
             $request->session()->put('limit', 102);
         }
         // if session is not set reset the session for the language
         if (!$request->session()->has('language')) {
             $request->session()->put('language', config('app.locale'));
         }
         // if session is not set reset the session for the currency
         if (!$request->session()->has('currency')) {
             $request->session()->put('currency', config('app.currency'));
         }
         if (!$request->session()->has('currency_rate')) {
             $currency = Currency::where('currency', config('app.currency'))->first();
             $request->session()->put('currency_rate', $currency->rate);
         }
         // if session is not set reset the session for the basket
         if (!$request->session()->has('basket')) {
             $request->session()->put('basket', ['subtotal' => 0, 'count' => 0, 'items' => []]);
         }
         // global list of categories
         if (!$request->session()->has('categories')) {
             $categories = Category::where('shop_id', $request->session()->get('shop'))->orderBy('order', 'asc')->get()->toArray();
             $request->session()->put('categories', $categories);
         }
         // global list of product filters
         if (!$request->session()->has('filters')) {
             $options = Option::all()->toArray();
             // Serialization of 'MongoDB\BSON\ObjectID' is not allowed
             $request->session()->put('filters', $options);
         }
         // share globals
         view()->share('language', $request->session()->get('language'));
         return $next($request);
     });
     // add controller & action to the body class
     $currentAction = $route->getActionName();
     list($controller, $method) = explode('@', $currentAction);
     $controller = preg_replace('/.*\\\\/', '', $controller);
     $action = preg_replace('/.*\\\\/', '', $method);
     view()->share('body_class', $controller . '-' . $action);
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:50,代码来源:ThemeController.php


示例17: createPaymentTerms

 private function createPaymentTerms()
 {
     $paymentTerms = [['num_days' => -1, 'name' => 'Net 0']];
     foreach ($paymentTerms as $paymentTerm) {
         if (!DB::table('payment_terms')->where('name', '=', $paymentTerm['name'])->get()) {
             PaymentTerm::create($paymentTerm);
         }
     }
     $currencies = [['name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => 'VND ', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF ', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'], ['name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Malaysian Ringgit', 'code' => 'MYR', 'symbol' => 'RM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Thai baht', 'code' => 'THB', 'symbol' => 'THB ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.']];
     foreach ($currencies as $currency) {
         if (!DB::table('currencies')->whereName($currency['name'])->get()) {
             Currency::create($currency);
         }
     }
 }
开发者ID:ricoa,项目名称:invoice-ninja,代码行数:15,代码来源:PaymentLibrariesSeeder.php


示例18: run

 public function run()
 {
     Eloquent::unguard();
     $currencies = [['name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'South African Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => '', 'precision' => '0', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => '', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'], ['name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Malaysian Ringgit', 'code' => 'MYR', 'symbol' => 'RM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Thai Baht', 'code' => 'THB', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Nigerian Naira', 'code' => 'NGN', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Argentine Peso', 'code' => 'ARS', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'United Arab Emirates Dirham', 'code' => 'AED', 'symbol' => 'DH ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Hong Kong Dollar', 'code' => 'HKD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Indonesian Rupiah', 'code' => 'IDR', 'symbol' => 'Rp', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Mexican Peso', 'code' => 'MXN', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Egyptian Pound', 'code' => 'EGP', 'symbol' => 'E£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Colombian Peso', 'code' => 'COP', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'West African Franc', 'code' => 'XOF', 'symbol' => 'CFA ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Chinese Renminbi', 'code' => 'CNY', 'symbol' => 'RMB ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Rwandan Franc', 'code' => 'RWF', 'symbol' => 'RF ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Tanzanian Shilling', 'code' => 'TZS', 'symbol' => 'TSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Netherlands Antillean Guilder', 'code' => 'ANG', 'symbol' => '', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Trinidad and Tobago Dollar', 'code' => 'TTD', 'symbol' => 'TT$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'East Caribbean Dollar', 'code' => 'XCD', 'symbol' => 'EC$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Ghanaian Cedi', 'code' => 'GHS', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Bulgarian Lev', 'code' => 'BGN', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], ['name' => 'Aruban Florin', 'code' => 'AWG', 'symbol' => 'Afl. ', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], ['name' => 'Turkish Lira', 'code' => 'TRY', 'symbol' => 'TL ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Romanian New Leu', 'code' => 'RON', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Croatian Kuna', 'code' => 'HKR', 'symbol' => 'kn', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Saudi Riyal', 'code' => 'SAR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Japanese Yen', 'code' => 'JPY', 'symbol' => '¥', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Maldivian Rufiyaa', 'code' => 'MVR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.']];
     foreach ($currencies as $currency) {
         $record = Currency::whereCode($currency['code'])->first();
         if ($record) {
             $record->name = $currency['name'];
             $record->symbol = $currency['symbol'];
             $record->thousand_separator = $currency['thousand_separator'];
             $record->decimal_separator = $currency['decimal_separator'];
             $record->save();
         } else {
             Currency::create($currency);
         }
     }
 }
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:17,代码来源:CurrenciesSeeder.php


示例19: createPaymentTerms

 private function createPaymentTerms()
 {
     $paymentTerms = [['num_days' => -1, 'name' => 'Net 0']];
     foreach ($paymentTerms as $paymentTerm) {
         if (!DB::table('payment_terms')->where('name', '=', $paymentTerm['name'])->get()) {
             PaymentTerm::create($paymentTerm);
         }
     }
     $currencies = [['name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'South African Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => 'VND ', 'precision' => '0', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF ', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'], ['name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Malaysian Ringgit', 'code' => 'MYR', 'symbol' => 'RM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Thai Baht', 'code' => 'THB', 'symbol' => 'THB ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Nigerian Naira', 'code' => 'NGN', 'symbol' => 'NGN ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Argentine Peso', 'code' => 'ARS', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'United Arab Emirates Dirham', 'code' => 'AED', 'symbol' => 'DH ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Hong Kong Dollar', 'code' => 'HKD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Indonesian Rupiah', 'code' => 'IDR', 'symbol' => 'Rp', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Mexican Peso', 'code' => 'MXN', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Egyptian Pound', 'code' => 'EGP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Colombian Peso', 'code' => 'COP', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'West African Franc', 'code' => 'XOF', 'symbol' => 'CFA ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Chinese Renminbi', 'code' => 'CNY', 'symbol' => 'RMB ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.']];
     foreach ($currencies as $currency) {
         $record = Currency::whereCode($currency['code'])->first();
         if ($record) {
             $record->name = $currency['name'];
             $record->thousand_separator = $currency['thousand_separator'];
             $record->decimal_separator = $currency['decimal_separator'];
             $record->save();
         } else {
             Currency::create($currency);
         }
     }
 }
开发者ID:jargij,项目名称:invoiceninja,代码行数:21,代码来源:PaymentLibrariesSeeder.php


示例20: addOperation

 public function addOperation()
 {
     if ($this->currency_id != '1') {
         $course = new Course();
         if (!$course->checkCourse($this->currency_id)) {
             $course->currency_id = $this->currency_id;
             $currency = Currency::findOne($this->currency_id);
             $course->course = $course->getCourse($currency->iso);
             if (!$course->save()) {
                 throw new ErrorException('Курс не обновлен' . var_dump($course));
             }
         }
     }
     $operation = new Operation();
     $operation->user_id = Yii::$app->getUser()->id;
     $operation->category_id = $this->category_id === '' ? 1 : $this->category_id;
     $operation->currency_id = $this->currency_id === '' ? 1 : $this->currency_id;
     $operation->summ = $this->operation_type == 'income' ? $this->summ * 100 : $this->summ * -100;
     $operation->description = $this->description;
     return $operation->save() ? $operation : null;
 }
开发者ID:Nhassa,项目名称:budget,代码行数:21,代码来源:OperationForm.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP models\Customer类代码示例发布时间:2022-05-23
下一篇:
PHP models\Course类代码示例发布时间: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