BrightSide Workbench Full Report + Source Code
ProductUsageValuation.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 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.erp.task;
20 
21 import org.turro.financials.product.IProduct;
22 import org.turro.financials.product.ProductFactory;
23 
28 public class ProductUsageValuation implements IUsageValuation {
29 
30  private IProduct product;
31  private long productId, providerId, providerProductId;
32  private String description;
33 
34  public ProductUsageValuation(IProduct product) {
35  this.product = product;
36  }
37 
38  public ProductUsageValuation(long productId, long providerId, long providerProductId, String description) {
39  this.productId = productId;
40  this.providerId = providerId;
41  this.providerProductId = providerProductId;
42  this.description = description;
43  this.product = ProductFactory.getProduct(productId, providerId, providerProductId, description);
44  }
45 
46  @Override
47  public double getUnitCost() {
48  double cost = 0.0;
49  if(product != null) {
50  cost = product.getProductCost();
51  }
52  return cost;
53  }
54 
55  @Override
56  public double getUnitPrice() {
57  double price = 0.0;
58  if(product != null) {
59  price = product.getProductPrice();
60  }
61  return price;
62  }
63 
64 }
ProductUsageValuation(long productId, long providerId, long providerProductId, String description)