Subversion Repositories SmartDukaan

Rev

Rev 32165 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32165 Rev 33459
Line 7... Line 7...
7
 
7
 
8
import java.util.List;
8
import java.util.List;
9
import java.util.Objects;
9
import java.util.Objects;
10
 
10
 
11
public class InventoryPayoutModel {
11
public class InventoryPayoutModel {
-
 
12
 
-
 
13
    public float getPriceDropAmount() {
-
 
14
        return priceDropAmount;
-
 
15
    }
-
 
16
 
-
 
17
    public void setPriceDropAmount(float priceDropAmount) {
-
 
18
        this.priceDropAmount = priceDropAmount;
-
 
19
    }
-
 
20
 
-
 
21
    float priceDropAmount;
12
    int inventoryItemId;
22
    int inventoryItemId;
13
    List<SchemeInOut> paidSios;
23
    List<SchemeInOut> paidSios;
14
    List<SchemeInOut> pendingSios;
24
    List<SchemeInOut> pendingSios;
15
    List<OfferPayout> offerPayouts;
25
    List<OfferPayout> offerPayouts;
16
 
26
 
-
 
27
 
17
    private double fixedAmount;
28
    private double fixedAmount;
-
 
29
    private double discountAmount;
-
 
30
 
-
 
31
    public double getDiscountAmount() {
-
 
32
        return discountAmount;
-
 
33
    }
-
 
34
 
-
 
35
    public void setDiscountAmount(double discountAmount) {
-
 
36
        this.discountAmount = discountAmount;
-
 
37
    }
-
 
38
 
18
    private double percentageAmount;
39
    private double percentageAmount;
19
    private double paidAmount;
40
    private double paidAmount;
20
    private double dp;
41
    private double dp;
21
 
42
 
22
    public List<SchemeInOut> getPendingSios() {
43
    public List<SchemeInOut> getPendingSios() {
23
        return pendingSios;
44
        return pendingSios;
24
    }
45
    }
25
 
46
 
26
    @Override
-
 
27
    public boolean equals(Object o) {
-
 
28
        if (this == o) return true;
-
 
29
        if (o == null || getClass() != o.getClass()) return false;
-
 
30
        InventoryPayoutModel that = (InventoryPayoutModel) o;
-
 
31
        return inventoryItemId == that.inventoryItemId && Double.compare(that.fixedAmount, fixedAmount) == 0 && Double.compare(that.percentageAmount, percentageAmount) == 0 && Double.compare(that.paidAmount, paidAmount) == 0 && Double.compare(that.dp, dp) == 0 && Objects.equals(paidSios, that.paidSios) && Objects.equals(pendingSios, that.pendingSios) && Objects.equals(offerPayouts, that.offerPayouts);
-
 
32
    }
-
 
33
 
-
 
34
    @Override
-
 
35
    public int hashCode() {
-
 
36
        return Objects.hash(inventoryItemId, paidSios, pendingSios, offerPayouts, fixedAmount, percentageAmount, paidAmount, dp);
-
 
37
    }
-
 
38
 
-
 
39
    public void setPendingSios(List<SchemeInOut> pendingSios) {
47
    public void setPendingSios(List<SchemeInOut> pendingSios) {
40
        this.pendingSios = pendingSios;
48
        this.pendingSios = pendingSios;
41
    }
49
    }
42
 
50
 
43
    public double getActualRolloutAmount() {
51
    public double getActualRolloutAmount() {
44
        double effectiveDp = this.getDp() - this.getFixedAmount();
52
        double effectiveDp = this.getDp() - this.getFixedAmount();
45
        double value = effectiveDp * percentageAmount / (100 + percentageAmount);
53
        double value = effectiveDp * percentageAmount / (100 + percentageAmount);
46
        return this.getFixedAmount() + value;
54
        return this.getFixedAmount() + value + this.getDiscountAmount();
47
    }
55
    }
48
 
56
 
49
 
57
 
50
    public double getRolloutAmount(AmountModel amountModel) {
58
    public double getRolloutAmount(AmountModel amountModel) {
51
        double rollout = 0;
59
        double rollout = 0;
Line 61... Line 69...
61
            }
69
            }
62
        }
70
        }
63
        return rollout;
71
        return rollout;
64
    }
72
    }
65
 
73
 
66
    public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> paidSios, List<SchemeInOut> pendingSios, List<OfferPayout> offerPayouts) {
74
    public InventoryPayoutModel(int inventoryItemId, float priceDropAmount, List<SchemeInOut> paidSios, List<SchemeInOut> pendingSios, List<OfferPayout> offerPayouts) {
67
        this.inventoryItemId = inventoryItemId;
75
        this.inventoryItemId = inventoryItemId;
68
        this.paidSios = paidSios;
76
        this.paidSios = paidSios;
69
        this.pendingSios = pendingSios;
77
        this.pendingSios = pendingSios;
70
        this.offerPayouts = offerPayouts;
78
        this.offerPayouts = offerPayouts;
71
    }
-
 
72
 
-
 
73
    @Override
-
 
74
    public String toString() {
-
 
75
        return "InventoryPayoutModel{" +
-
 
76
                "inventoryItemId=" + inventoryItemId +
-
 
77
                ", paidSios=" + paidSios +
-
 
78
                ", offerPayouts=" + offerPayouts +
-
 
79
                ", fixedAmount=" + fixedAmount +
-
 
80
                ", percentageAmount=" + percentageAmount +
79
        this.priceDropAmount = priceDropAmount;
81
                ", paidAmount=" + paidAmount +
-
 
82
                '}';
-
 
83
    }
80
    }
84
 
81
 
85
    public double getPercentageAmount() {
82
    public double getPercentageAmount() {
86
        return percentageAmount;
83
        return percentageAmount;
87
    }
84
    }
Line 135... Line 132...
135
    }
132
    }
136
 
133
 
137
    public void setOfferPayouts(List<OfferPayout> offerPayouts) {
134
    public void setOfferPayouts(List<OfferPayout> offerPayouts) {
138
        this.offerPayouts = offerPayouts;
135
        this.offerPayouts = offerPayouts;
139
    }
136
    }
-
 
137
 
-
 
138
    @Override
-
 
139
    public boolean equals(Object o) {
-
 
140
        if (this == o) return true;
-
 
141
        if (o == null || getClass() != o.getClass()) return false;
-
 
142
        InventoryPayoutModel that = (InventoryPayoutModel) o;
-
 
143
        return Float.compare(priceDropAmount, that.priceDropAmount) == 0 && inventoryItemId == that.inventoryItemId && Double.compare(fixedAmount, that.fixedAmount) == 0 && Double.compare(discountAmount, that.discountAmount) == 0 && Double.compare(percentageAmount, that.percentageAmount) == 0 && Double.compare(paidAmount, that.paidAmount) == 0 && Double.compare(dp, that.dp) == 0 && Objects.equals(paidSios, that.paidSios) && Objects.equals(pendingSios, that.pendingSios) && Objects.equals(offerPayouts, that.offerPayouts);
-
 
144
    }
-
 
145
 
-
 
146
    @Override
-
 
147
    public int hashCode() {
-
 
148
        return Objects.hash(priceDropAmount, inventoryItemId, paidSios, pendingSios, offerPayouts, fixedAmount, discountAmount, percentageAmount, paidAmount, dp);
-
 
149
    }
-
 
150
 
-
 
151
    @Override
-
 
152
    public String toString() {
-
 
153
        return "InventoryPayoutModel{" +
-
 
154
                "priceDropAmount=" + priceDropAmount +
-
 
155
                ", inventoryItemId=" + inventoryItemId +
-
 
156
                ", paidSios=" + paidSios +
-
 
157
                ", pendingSios=" + pendingSios +
-
 
158
                ", offerPayouts=" + offerPayouts +
-
 
159
                ", fixedAmount=" + fixedAmount +
-
 
160
                ", discountAmount=" + discountAmount +
-
 
161
                ", percentageAmount=" + percentageAmount +
-
 
162
                ", paidAmount=" + paidAmount +
-
 
163
                ", dp=" + dp +
-
 
164
                '}';
-
 
165
    }
140
}
166
}