| Line 5... |
Line 5... |
| 5 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
5 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 6 |
import com.spice.profitmandi.dao.model.AmountModel;
|
6 |
import com.spice.profitmandi.dao.model.AmountModel;
|
| 7 |
|
7 |
|
| 8 |
import java.util.List;
|
8 |
import java.util.List;
|
| 9 |
import java.util.Objects;
|
9 |
import java.util.Objects;
|
| 10 |
import java.util.stream.Collectors;
|
- |
|
| 11 |
|
10 |
|
| 12 |
public class InventoryPayoutModel {
|
11 |
public class InventoryPayoutModel {
|
| 13 |
int inventoryItemId;
|
12 |
int inventoryItemId;
|
| 14 |
List<SchemeInOut> schemePayouts;
|
13 |
List<SchemeInOut> schemePayouts;
|
| 15 |
List<OfferPayout> offerPayouts;
|
14 |
List<OfferPayout> offerPayouts;
|
| Line 19... |
Line 18... |
| 19 |
private double paidAmount;
|
18 |
private double paidAmount;
|
| 20 |
private double dp;
|
19 |
private double dp;
|
| 21 |
|
20 |
|
| 22 |
public double getActualRolloutAmount() {
|
21 |
public double getActualRolloutAmount() {
|
| 23 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
22 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
| 24 |
double value = effectiveDp*percentageAmount/(100 + percentageAmount);
|
23 |
double value = effectiveDp * percentageAmount / (100 + percentageAmount);
|
| 25 |
return this.getFixedAmount() + value;
|
24 |
return this.getFixedAmount() + value;
|
| 26 |
}
|
25 |
}
|
| 27 |
|
26 |
|
| 28 |
|
27 |
|
| 29 |
|
- |
|
| 30 |
public double getRolloutAmount(AmountModel amountModel) {
|
28 |
public double getRolloutAmount(AmountModel amountModel) {
|
| 31 |
double rollout = 0;
|
29 |
double rollout = 0;
|
| 32 |
if (amountModel.getAmountType().equals(AmountType.PERCENTAGE)) {
|
30 |
if (amountModel.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| 33 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
31 |
double effectiveDp = this.getDp() - this.getFixedAmount();
|
| 34 |
double totalPercentage = this.getPercentageAmount() + amountModel.getAmount();
|
32 |
double totalPercentage = this.getPercentageAmount() + amountModel.getAmount();
|
| 35 |
rollout = effectiveDp * (totalPercentage / (100 + totalPercentage) - (this.getPercentageAmount() / (100 + this.getPercentageAmount())));
|
33 |
rollout = effectiveDp * (totalPercentage / (100 + totalPercentage) - (this.getPercentageAmount() / (100 + this.getPercentageAmount())));
|
| 36 |
} else {
|
34 |
} else {
|
| - |
|
35 |
if (amountModel.isDiscount()) {
|
| - |
|
36 |
rollout = amountModel.getAmount();
|
| - |
|
37 |
} else {
|
| 37 |
rollout = amountModel.getAmount() * (100 / (100 + this.getPercentageAmount()));
|
38 |
rollout = amountModel.getAmount() * (100 / (100 + this.getPercentageAmount()));
|
| - |
|
39 |
}
|
| 38 |
}
|
40 |
}
|
| 39 |
return rollout;
|
41 |
return rollout;
|
| 40 |
}
|
42 |
}
|
| 41 |
|
43 |
|
| 42 |
public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> schemePayouts, List<OfferPayout> offerPayouts) {
|
44 |
public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> schemePayouts, List<OfferPayout> offerPayouts) {
|