當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。