예제 #1
0
        public string Statement(Invoice invoice, PlayLists plays)
        {
            double totalAmount   = 0.0;
            double volumeCredits = 0.0;
            string result        = $"Statement for ${ invoice.Customer.Name}\n";

            // Gets a NumberFormatInfo associated with the en-US culture.
            NumberFormatInfo nfi            = new CultureInfo("en-US", false).NumberFormat;
            string           currencyFormat = "C";



            //const format = new Intl.NumberFormat("en­US", style: "currency", currency: "USD", minimumFractionDigits: 2 }).format;

            foreach (var perf in invoice.performances)
            {
                //var play = this.plays[perf.playID];
                //double thisAmount = 0;
                //thisAmount = AmountFor(perf);

                //// add volume credits
                //volumeCredits += Math.Max(perf.audience - 30, 0);

                //// add extra credit for every ten comedy attendees
                //if ("comedy" == PlayFor(perf).Type) volumeCredits += Math.Floor(perf.audience / 5.0);

                volumeCredits += VolumeCreditFor(perf);

                // print line for this order
                result      += $"{PlayFor(perf).Name}: $({Format(AmountFor(perf) / 100)} (${perf.audience} seats)\n";
                totalAmount += AmountFor(perf);
            }
            result += $"Amount owed is ${Format((totalAmount/100))}\n";
            result += $"You earned ${volumeCredits} credits\n";
            return(result);
        }
예제 #2
0
 public Invoice()
 {
     plays = new PlayLists();
 }