| Line 678... |
Line 678... |
| 678 |
}
|
678 |
}
|
| 679 |
}
|
679 |
}
|
| 680 |
return eligibleSlab;
|
680 |
return eligibleSlab;
|
| 681 |
}
|
681 |
}
|
| 682 |
|
682 |
|
| - |
|
683 |
private void setSlabProgress(ItemCriteriaPayout itemCriteriaPayout, PayoutSlab eligibleSlab, int achievedValue) {
|
| - |
|
684 |
List<PayoutSlab> slabs = itemCriteriaPayout.getPayoutSlabs();
|
| - |
|
685 |
itemCriteriaPayout.setCurrentSlab(eligibleSlab);
|
| - |
|
686 |
if (eligibleSlab == null) {
|
| - |
|
687 |
if (!slabs.isEmpty()) {
|
| - |
|
688 |
itemCriteriaPayout.setNextSlab(slabs.get(0));
|
| - |
|
689 |
itemCriteriaPayout.setShortValue(slabs.get(0).getOnwardsAmount() - achievedValue);
|
| - |
|
690 |
}
|
| - |
|
691 |
} else {
|
| - |
|
692 |
int idx = slabs.indexOf(eligibleSlab);
|
| - |
|
693 |
if (idx < slabs.size() - 1) {
|
| - |
|
694 |
PayoutSlab next = slabs.get(idx + 1);
|
| - |
|
695 |
itemCriteriaPayout.setNextSlab(next);
|
| - |
|
696 |
itemCriteriaPayout.setShortValue(next.getOnwardsAmount() - achievedValue);
|
| - |
|
697 |
} else {
|
| - |
|
698 |
itemCriteriaPayout.setNextSlab(null);
|
| - |
|
699 |
itemCriteriaPayout.setShortValue(0);
|
| - |
|
700 |
}
|
| - |
|
701 |
}
|
| - |
|
702 |
}
|
| - |
|
703 |
|
| 683 |
private double calculateFinalPayout(PayoutSlab eligibleSlab, AmountType amountType,
|
704 |
private double calculateFinalPayout(PayoutSlab eligibleSlab, AmountType amountType,
|
| 684 |
int valueForPercentage, int valueForFixed) {
|
705 |
int valueForPercentage, int valueForFixed) {
|
| 685 |
if (eligibleSlab == null) return 0;
|
706 |
if (eligibleSlab == null) return 0;
|
| 686 |
eligibleSlab.setSelected(true);
|
707 |
eligibleSlab.setSelected(true);
|
| 687 |
float payoutRate = eligibleSlab.getPayoutAmount();
|
708 |
float payoutRate = eligibleSlab.getPayoutAmount();
|
| Line 746... |
Line 767... |
| 746 |
}
|
767 |
}
|
| 747 |
qtyAmountModel.setQty(totalBaseQty);
|
768 |
qtyAmountModel.setQty(totalBaseQty);
|
| 748 |
qtyAmountModel.setAmount(totalBaseValue);
|
769 |
qtyAmountModel.setAmount(totalBaseValue);
|
| 749 |
|
770 |
|
| 750 |
PayoutSlab eligibleSlab = findEligibleSlab(itemCriteriaPayout.getPayoutSlabs(), purchasedValue);
|
771 |
PayoutSlab eligibleSlab = findEligibleSlab(itemCriteriaPayout.getPayoutSlabs(), purchasedValue);
|
| - |
|
772 |
setSlabProgress(itemCriteriaPayout, eligibleSlab, purchasedValue);
|
| 751 |
double finalPayout = calculateFinalPayout(eligibleSlab, itemCriteriaPayout.getAmountType(),
|
773 |
double finalPayout = calculateFinalPayout(eligibleSlab, itemCriteriaPayout.getAmountType(),
|
| 752 |
purchasedValue, purchasedValue);
|
774 |
purchasedValue, purchasedValue);
|
| 753 |
qtyAmountModel.setFinalPayout(finalPayout);
|
775 |
qtyAmountModel.setFinalPayout(finalPayout);
|
| 754 |
}
|
776 |
}
|
| 755 |
return criteriaQtyAmountMap;
|
777 |
return criteriaQtyAmountMap;
|
| Line 861... |
Line 883... |
| 861 |
eligibleSale = eligibleBaseQty;
|
883 |
eligibleSale = eligibleBaseQty;
|
| 862 |
eligibleCriteriaSale = eligibleQty;
|
884 |
eligibleCriteriaSale = eligibleQty;
|
| 863 |
}
|
885 |
}
|
| 864 |
|
886 |
|
| 865 |
PayoutSlab eligibleSlab = findEligibleSlab(itemCriteriaPayout.getPayoutSlabs(), eligibleSale);
|
887 |
PayoutSlab eligibleSlab = findEligibleSlab(itemCriteriaPayout.getPayoutSlabs(), eligibleSale);
|
| - |
|
888 |
setSlabProgress(itemCriteriaPayout, eligibleSlab, eligibleSale);
|
| 866 |
double finalPayout = calculateFinalPayout(eligibleSlab, itemCriteriaPayout.getAmountType(),
|
889 |
double finalPayout = calculateFinalPayout(eligibleSlab, itemCriteriaPayout.getAmountType(),
|
| 867 |
eligibleCriteriaSaleDp, eligibleCriteriaSale);
|
890 |
eligibleCriteriaSaleDp, eligibleCriteriaSale);
|
| 868 |
if (eligibleSlab != null) {
|
891 |
if (eligibleSlab != null) {
|
| 869 |
LOGGER.info("Eligible Slab {}", eligibleSlab);
|
892 |
LOGGER.info("Eligible Slab {}", eligibleSlab);
|
| 870 |
}
|
893 |
}
|