Example #1
0
 //adds an invoice to an airline
 public static void AddAirlineInvoice(Airline airline, DateTime date, Invoice.InvoiceType type, double amount)
 {
     if (airline.IsHuman && GameObject.GetInstance().HumanAirline == airline)
     {
         GameObject.GetInstance().addHumanMoney(amount);
         GameObject.GetInstance().HumanAirline.addInvoice(new Invoice(date, type, amount), false);
     }
     else
         airline.addInvoice(new Invoice(date, type, amount));
 }
Example #2
0
 public void setInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     this.Invoices.addInvoice(type, year, month, amount);
 }
Example #3
0
 // chs, 2011-13-10 added function to add an invoice without have to pay for it. Used for loading of saved game
 //sets an invoice to the airline - no payment is made
 public void setInvoice(Invoice invoice)
 {
     this.Invoices.addInvoice(invoice);
 }
Example #4
0
 public double getInvoicesAmountYear(int year, Invoice.InvoiceType type)
 {
     if (type == Invoice.InvoiceType.Total)
         return this.Invoices.getYearlyAmount(year);
     else
         return this.Invoices.getYearlyAmount(type, year);
 }
Example #5
0
 public double getInvoicesAmountMonth(int year,int month, Invoice.InvoiceType type)
 {
     if (type == Invoice.InvoiceType.Total)
         return this.Invoices.getAmount(year, month);
     else
         return this.Invoices.getAmount(type, year, month);
 }
Example #6
0
        /*
        //returns all invoices with type
        public List<Invoice> getInvoices(DateTime start, DateTime end, Invoice.InvoiceType type)

        {
            return this.Invoices.FindAll(i=>i.Date>=start && i.Date <=end && i.Type == type);
        }
        //returns all the invoices in a specific period
        public List<Invoice> getInvoices(DateTime start, DateTime end)
        {
           return this.Invoices.FindAll(delegate(Invoice i) { return i.Date >= start && i.Date <= end; });

        }
           */
        //returns the amount of all the invoices in a specific period of a specific type
        public double getInvoicesAmount(DateTime startTime, DateTime endTime, Invoice.InvoiceType type)
        {
            int startYear = startTime.Year;
            int endYear = endTime.Year;

            int startMonth = startTime.Month;
            int endMonth = endTime.Month;

            int totalMonths = (endMonth - startMonth) + 12 * (endYear - startYear) +1;

            double totalAmount = 0;

            DateTime date = new DateTime(startYear, startMonth, 1);

            for (int i = 0; i < totalMonths; i++)
            {
                if (type == Invoice.InvoiceType.Total)
                    totalAmount += this.Invoices.getAmount(date.Year, date.Month);
                else
                    totalAmount += this.Invoices.getAmount(type, date.Year, date.Month);

                date = date.AddMonths(1);
            }

            return totalAmount;
        }
Example #7
0
        //adds an invoice for the airline - both incoming and expends - if updateMoney == true the money is updated as well
        public void addInvoice(Invoice invoice, Boolean updateMoney = true)
        {
            this.Invoices.addInvoice(invoice);

            if (updateMoney)
                this.Money += invoice.Amount;
        }
 //adds an invoice for the airline - both incoming and expends
 public void addInvoice(Invoice invoice)
 {
     this.Invoices.addInvoice(invoice);
     this.Money += invoice.Amount;
 }
Example #9
0
        //returns invoices amount for a specific type for a route
        public double getRouteInvoiceAmount(Invoice.InvoiceType type)
        {
            double amount = 0;
            foreach (StopoverRoute stopover in this.Stopovers)
            {
                amount += stopover.Legs.Sum(l => l.getRouteInvoiceAmount(type));
            }

            if (type == Invoice.InvoiceType.Total)
                amount += this.Invoices.getAmount();
            else
                amount += this.Invoices.getAmount(type);

            return amount;
        }
Example #10
0
 //adds an invoice for a route
 public void addRouteInvoice(Invoice invoice)
 {
     this.Invoices.addInvoice(invoice);
 }
 public SpecsItem(Airline airline,Invoice.InvoiceType type)
 {
     this.InvoiceType = type;
     this.Airline = airline;
 }
 public AirlineFinanceMVVM(Airline airline, Invoice.InvoiceType type)
 {
     this.InvoiceType = type;
     this.Airline = airline;
 }