BrightSide Workbench Full Report + Source Code
ExpensesEntry.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2023 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.financials.book;
20 
21 import java.util.Date;
22 import org.turro.util.Comparison;
23 
28 public class ExpensesEntry implements Comparable<ExpensesEntry> {
29 
30  private final String docNumber, globalIdentifier, provider, type;
31  private final Date receiptDate, docDate;
32  private final double tax, taxable, taxAmount, total;
33 
34  public ExpensesEntry(String docNumber, String globalIdentifier, String provider,
35  String type, Date receiptDate, Date docDate, double tax, double taxable, double taxAmount, double total) {
36  this.docNumber = docNumber;
37  this.globalIdentifier = globalIdentifier;
38  this.provider = provider;
39  this.type = type;
40  this.receiptDate = receiptDate;
41  this.docDate = docDate;
42  this.tax = tax;
43  this.taxable = taxable;
44  this.taxAmount = taxAmount;
45  this.total = total;
46  }
47 
48  public String getDocNumber() {
49  return docNumber;
50  }
51 
52  public String getGlobalIdentifier() {
53  return globalIdentifier;
54  }
55 
56  public String getProvider() {
57  return provider;
58  }
59 
60  public String getType() {
61  return type;
62  }
63 
64  public Date getReceiptDate() {
65  return receiptDate;
66  }
67 
68  public Date getDocDate() {
69  return docDate;
70  }
71 
72  public double getTax() {
73  return tax;
74  }
75 
76  public double getTaxable() {
77  return taxable;
78  }
79 
80  public double getTaxAmount() {
81  return taxAmount;
82  }
83 
84  public double getTotal() {
85  return total;
86  }
87 
88  @Override
89  public int compareTo(ExpensesEntry o) {
90  return Comparison.ascendant()
91  .compare(receiptDate, o.receiptDate)
92  .compareDate(docDate, o.docDate)
93  .compare(docNumber, o.docNumber)
94  .compare(globalIdentifier, o.globalIdentifier)
95  .get();
96  }
97 
98 }
ExpensesEntry(String docNumber, String globalIdentifier, String provider, String type, Date receiptDate, Date docDate, double tax, double taxable, double taxAmount, double total)