示例#1
0
        //returns the invoices amount for a specific type for a period
        public double getRouteInvoiceAmount(Invoice.InvoiceType type, DateTime startTime, DateTime endTime)
        {
            int startYear = startTime.Year;
            int endYear   = endTime.Year;

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

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

            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);
        }
示例#2
0
 public MonthlyInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     this.Type   = type;
     this.Year   = year;
     this.Month  = month;
     this.Amount = amount;
 }
示例#3
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));
     }
 }
示例#4
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));
     }
 }
示例#5
0
        //returns if the invoices contains a month, year and type element
        public Boolean contains(Invoice.InvoiceType type, int year, int month)
        {
            Boolean contains;

            lock (this.MonthlyInvoices)
            {
                contains = this.MonthlyInvoices.Exists(m => m.Month == month && m.Year == year && m.Type == type);
            }

            return(contains);
        }
示例#6
0
 //returns the total amount for a given year, month and type
 public double getAmount(Invoice.InvoiceType type, int year, int month)
 {
     if (contains(type, year, month))
     {
         MonthlyInvoice mInvoice = this.MonthlyInvoices.Find(m => m.Month == month && m.Year == year && m.Type == type);
         return(mInvoice.Amount);
     }
     else
     {
         return(0);
     }
 }
示例#7
0
 public void addInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     lock (this.MonthlyInvoices)
     {
         if (contains(type, year, month))
         {
             MonthlyInvoice mInvoice = this.MonthlyInvoices.Find(m => m.Month == month && m.Year == year && m.Type == type);
             mInvoice.Amount += amount;
         }
         else
         {
             MonthlyInvoice mInvoice = new MonthlyInvoice(type, year, month, amount);
             this.MonthlyInvoices.Add(mInvoice);
         }
     }
 }
示例#8
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);
        }
示例#9
0
 //sets the invoice to the route
 public void setRouteInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     this.Invoices.addInvoice(type, year, month, amount);
 }
示例#10
0
 public MonthlyInvoice(Invoice.InvoiceType type, int year, int month)
     : this(type, year, month, 0)
 {
 }
示例#11
0
 public SpecsItem(Airline airline, Invoice.InvoiceType type)
 {
     this.InvoiceType = type;
     this.Airline     = airline;
 }
示例#12
0
 public AirlineFinanceMVVM(Airline airline, Invoice.InvoiceType type)
 {
     this.InvoiceType = type;
     this.Airline     = airline;
 }
示例#13
0
 //returns the total amount for a given type
 public double getAmount(Invoice.InvoiceType type)
 {
     return(this.MonthlyInvoices.FindAll(i => i.Type == type).Sum(i => i.Amount));
 }
示例#14
0
 //returns the yearly amount for a given type and year
 public double getYearlyAmount(Invoice.InvoiceType type, int year)
 {
     return(this.MonthlyInvoices.FindAll(i => i.Type == type && i.Year == year).Sum(i => i.Amount));
 }