BrightSide Workbench Full Report + Source Code
CartAmounts.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2016 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.cart;
20
25
public
class
CartAmounts
{
26
27
private
final
Cart
cart;
28
private
CartTaxableSet
taxables;
29
30
public
CartAmounts
(
Cart
cart) {
31
this.cart = cart;
32
createAmounts();
33
}
34
35
public
CartTaxableSet
getTaxables
() {
36
return
taxables;
37
}
38
39
public
double
getAmount
() {
40
double
amount = 0.0;
41
for
(
CartTaxable
at : taxables) {
42
amount += at.getAmount();
43
}
44
return
amount;
45
}
46
47
public
double
getDiscount
() {
48
double
amount = 0.0;
49
for
(
CartTaxable
at : taxables) {
50
amount += at.getDiscount();
51
}
52
return
amount;
53
}
54
55
public
double
getTotal
() {
56
double
amount = 0.0;
57
for
(
CartTaxable
at : taxables) {
58
if
(at.isPerCent(0.0)) {
59
amount += at.getTaxable();
60
}
else
{
61
amount += at.getTotal();
62
}
63
}
64
return
amount;
65
}
66
67
private
void
createAmounts() {
68
taxables =
new
CartTaxableSet
();
69
for
(
CartItem
dl : cart.
getItems
()) {
70
double
tax = dl.getTax();
71
taxables.
add
(tax, dl.getTax(), dl.getTaxAmount(), dl.getAmount(), dl.getTaxable());
72
}
73
taxables.
clearEmpty
();
74
}
75
76
}
org.turro.financials.cart.CartAmounts
Definition:
CartAmounts.java:25
org.turro.financials.cart.CartAmounts.getAmount
double getAmount()
Definition:
CartAmounts.java:39
org.turro.financials.cart.CartAmounts.getDiscount
double getDiscount()
Definition:
CartAmounts.java:47
org.turro.financials.cart.CartAmounts.getTotal
double getTotal()
Definition:
CartAmounts.java:55
org.turro.financials.cart.CartAmounts.getTaxables
CartTaxableSet getTaxables()
Definition:
CartAmounts.java:35
org.turro.financials.cart.CartAmounts.CartAmounts
CartAmounts(Cart cart)
Definition:
CartAmounts.java:30
org.turro.financials.cart.CartItem
Definition:
CartItem.java:31
org.turro.financials.cart.CartTaxableSet
Definition:
CartTaxableSet.java:28
org.turro.financials.cart.CartTaxableSet.clearEmpty
void clearEmpty()
Definition:
CartTaxableSet.java:69
org.turro.financials.cart.CartTaxableSet.add
boolean add(Double perCent, Double tax, Double taxValue, Double subtotal, Double taxable)
Definition:
CartTaxableSet.java:30
org.turro.financials.cart.CartTaxable
Definition:
CartTaxable.java:27
org.turro.financials.cart.Cart
Definition:
Cart.java:37
org.turro.financials.cart.Cart.getItems
CartItemSet getItems()
Definition:
Cart.java:54
TurroProjects
Public
BrightSide
bsfinancials-core
src
main
java
org
turro
financials
cart
CartAmounts.java
Generated on Tue Mar 12 2024 07:01:18 for BrightSide by
1.9.1