View Javadoc

1   /*
2    * @(#)Bill.java Mar 3, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  
14  package nl.tudelft.simulation.supplychain.content;
15  
16  import java.io.Serializable;
17  
18  import nl.tudelft.simulation.supplychain.actor.SupplyChainActor;
19  import nl.tudelft.simulation.supplychain.product.Product;
20  
21  /***
22   * The bill represents a document that asks for payment for a product or
23   * service. It contains a pointer to an Order to see for which exact order the
24   * actor is invoiced.
25   * <p>
26   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
27   * Delft, the Netherlands. All rights reserved.
28   * 
29   * See for project information <a href="http://www.simulation.tudelft.nl/">
30   * www.simulation.tudelft.nl </a>.
31   * 
32   * The source code and binary code of this software is proprietary information
33   * of Delft University of Technology.
34   * 
35   * @author <a
36   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
37   *         Verbraeck </a>
38   * @version $$Revision: 1.3 $$ $$Date: 2005/04/08 12:00:56 $$
39   */
40  public class Bill extends Content
41  {
42  	/*** the serial version uid */
43  	private static final long serialVersionUID = 12L;
44  
45  	/*** the simulation time for final payment */
46  	private double finalPaymentDate;
47  
48  	/*** the price that has to be paid */
49  	private double price;
50  
51  	/*** the order to which this bill belongs */
52  	private Order order;
53  
54  	/*** the description */
55  	private String description;
56  
57  	/*** whether the bill is paid or not */
58  	private boolean isPaid = false;
59  
60  	/***
61  	 * Constructs a new Bill.
62  	 * 
63  	 * @param sender the sender
64  	 * @param receiver the receiver
65  	 * @param internalDemandID the unique internal demand id of this bill
66  	 * @param order the order the bill is sent for
67  	 * @param finalPaymentDate the final payment date of the bill
68  	 * @param price the amount to be paid
69  	 * @param description the description
70  	 */
71  
72  	// TODO implement description of bill (e.g. normal, fine, tax, etc)
73  	public Bill(final SupplyChainActor sender, final SupplyChainActor receiver,
74  			final Serializable internalDemandID, final Order order,
75  			final double finalPaymentDate, final double price,
76  			final String description)
77  	{
78  		super(sender, receiver, internalDemandID);
79  		this.finalPaymentDate = finalPaymentDate;
80  		this.order = order;
81  		this.price = price;
82  		this.description = description;
83  	}
84  
85  	/***
86  	 * Returns the finalPaymentDate.
87  	 * 
88  	 * @return double the final payment date of the bill
89  	 */
90  	public double getFinalPaymentDate()
91  	{
92  		return this.finalPaymentDate;
93  	}
94  
95  	/***
96  	 * Returns the order.
97  	 * 
98  	 * @return Order the order to which this bill belongs
99  	 */
100 	public Order getOrder()
101 	{
102 		return this.order;
103 	}
104 
105 	/***
106 	 * Returns the price.
107 	 * 
108 	 * @return double the amount of money to pay
109 	 */
110 	public double getPrice()
111 	{
112 		return this.price;
113 	}
114 
115 	/***
116 	 * @see java.lang.Object#toString()
117 	 */
118 	public String toString()
119 	{
120 		return super.toString() + " for " + this.getOrder().toString()
121 				+ ", price=" + this.getPrice() + " Description: "
122 				+ this.description;
123 	}
124 
125 	/***
126 	 * @see nl.tudelft.simulation.supplychain.content.Content#getProduct()
127 	 */
128 	public Product getProduct()
129 	{
130 		return this.order.getProduct();
131 	}
132 
133 	/***
134 	 * @return Returns the description.
135 	 */
136 	public String getDescription()
137 	{
138 		return this.description;
139 	}
140 
141 
142 	/***
143 	 * @return Returns false if the bill has not been paid yet
144 	 */
145 	public boolean isPaid()
146 	{
147 		return this.isPaid;
148 	}
149 
150 	/***
151 	 * @param isPaid true if paid
152 	 */
153 	public void setPaid(final boolean isPaid)
154 	{
155 		this.isPaid = isPaid;
156 	}
157 }