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


TypeScript accounting.formatMoney函数代码示例

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


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

示例1: constructor

 constructor(rows: PlayerEarningsDisplayRow[], bonus1: boolean, bonus2: boolean, bonusAmount: number) {
   const total = Enumerable.from(rows).sum((row) => row.earned) +
     (bonus1 ? bonusAmount : 0) + (bonus2 ? bonusAmount : 0);
   this.rows = rows;
   this.total = total;
   this.totalDisp = accounting.formatMoney(total, "$", 0);
   this.bonus1 = bonus1;
   this.bonus2 = bonus2;
   this.bonusAmount = bonusAmount;
   this.bonusAmountDisp = accounting.formatMoney(this.bonusAmount, "$", 0);
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:11,代码来源:playerEarningsDisplay.ts

示例2: formatMoney

export default function formatMoney(
  moneyValue: string,
  opts: Handlebars.HelperOptions
) {
  let pattern = opts.hash.pattern || DEFAULT_PATTERN;
  return accounting.formatMoney(moneyValue);
}
开发者ID:qjac,项目名称:sql-fundamentals,代码行数:7,代码来源:format-money.ts

示例3: constructor

 constructor(name: string, bonus1Selection: boolean, bonus2Selection: boolean, shares: number, earned: number) {
   this.name = name;
   this.bonus1Selection = bonus1Selection;
   this.bonus2Selection = bonus2Selection;
   this.shares = shares;
   this.earned = earned;
   this.earnedDisp = accounting.formatMoney(earned, "$", 0);
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:8,代码来源:movieEarningsDisplayRow.ts

示例4: formatMoney

/**
 * Format number into euros.
 */
function formatMoney(amount: number) {
  return accounting.formatMoney(amount, {
    symbol: '€',
    format: '%v %s',
    decimal: ',',
    thousand: '.',
    precision: 2
  })
}
开发者ID:ilmaria,项目名称:laskutus-electron,代码行数:12,代码来源:invoice.ts

示例5: constructor

 constructor(movie: Movie, isBestMovie: boolean, isWorstMovie: boolean, shares: number, gross: number) {
   const value = gross / shares || 0;
   this.id = movie.id;
   this.name = movie.name;
   this.releaseDateInt = parseInt(moment(movie.releaseDate).format("X"), 10);
   this.releaseDate = moment(movie.releaseDate).format("MMM DD");
   this.rating = movie.rating;
   this.isBestMovie = isBestMovie;
   this.isWorstMovie = isWorstMovie;
   this.posterUrl = `/images/${(movie.imdb || "").replace("https://www.imdb.com/title/", "")}.jpg`;
   this.shares = shares;
   this.gross = gross;
   this.grossDisp = accounting.formatMoney(gross, "$", 0);
   this.grossDispShort = MovieHelpers.formatShortCurrency(gross);
   this.value = value;
   this.valueDisp = accounting.formatMoney(value, "$", 0);
   this.valueDispShort = MovieHelpers.formatShortCurrency(value);
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:18,代码来源:earningsDisplay.ts

示例6: constructor

 constructor(movie: Movie, shares: number, earned: number, bonus1: boolean, bonus2: boolean) {
   this.name = movie.name;
   this.releaseDate = moment(movie.releaseDate).format("MMM DD");
   this.shares = shares;
   this.earned = earned;
   this.earnedDisp = accounting.formatMoney(earned, "$", 0);
   this.bonus1Selection = bonus1;
   this.bonus2Selection = bonus2;
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:9,代码来源:playerEarningsDisplayRow.ts

示例7: constructor

 constructor(player: Player, hasBonus1: boolean, hasBonus2: boolean, sharesUsed: number, total: number) {
   this.rank = 0;
   this.name = player.name;
   this.id = player.id;
   this.hasBonus1 = hasBonus1;
   this.hasBonus2 = hasBonus2;
   this.sharesUsed = sharesUsed;
   this.total = total;
   this.totalDisp = accounting.formatMoney(total, "$", 0);
   this.perShare = total / sharesUsed || 0;
   this.perShareDisp = MovieHelpers.formatShortCurrency(sharesUsed > 0 ? total / sharesUsed : 0);
   this.enteredMoneyPool = player.enteredMoneyPool;
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:13,代码来源:standingsDisplay.ts

示例8: downloadEarnings

  public async downloadEarnings(): Promise<void> {
    const date: Date = moment().tz("America/New_York").toDate();
    const dateStr: string = moment().tz("America/New_York").format("YYYY-MM-DD");
    const dateThreshold: Date = moment().add(5, "days").tz("America/New_York").toDate();
    const currentSeason = await this.sql.getSelectedSeason(undefined);
    if (currentSeason === undefined || currentSeason.getEndDate() < date) {
      return;
    }

    const moviesToGet = Enumerable.from(currentSeason.movies)
      .where((m) => m.releaseDate <= dateThreshold)
      .orderByDescending((m) => m.releaseDate)
      .toArray();

    let earnings: Earning[] = [];
    for (const url of currentSeason.urls) {
      const html = await this.http.download(url.url, {});
      const rows = MojoParser.parse(html);
      const earningsToAdd = MojoParser.getEarnings(rows, moviesToGet);
      earnings = earnings.concat(earningsToAdd);
    }

    for (const earning of earnings) {
      const value = accounting.formatMoney(earning.gross, "$", 0);
      this.output.write(`${earning.movie.name}: ${value}\n`);
    }

    await this.sql.deleteEarningsForDate(dateStr);
    const addPromise = this.sql.addEarningsForMovies(earnings);

    this.output.write("\n");

    const ratingsPromises: Array<Promise<void>> = [];
    for (const movie of moviesToGet) {
      if (movie.metacriticUrl === undefined) {
        continue;
      }
      const rating = await this.getRating(movie.metacriticUrl, 0);
      if (rating === undefined) {
        continue;
      }
      ratingsPromises.push(this.sql.updateRatingForMovie(movie, rating));
      this.output.write(`${movie.name}: ${rating}%\n`);
    }

    await addPromise;
    await Promise.all(ratingsPromises);
  }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:48,代码来源:earningsDownloader.ts

示例9: getFormattedBonusAmount

 public getFormattedBonusAmount(): string {
   return accounting.formatMoney(this.bonusAmount, "$", 0);
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:3,代码来源:season.ts

示例10: totalEarnedDisp

 public totalEarnedDisp() {
   const totalEarned = Enumerable.from(this.rows).select((r) => r.earned).sum();
   return accounting.formatMoney(totalEarned, "$", 0);
 }
开发者ID:snickroger,项目名称:FantasyMovieLeague,代码行数:4,代码来源:movieEarningsDisplay.ts


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