Subversion Repositories SmartDukaan

Rev

Rev 31914 | Rev 31988 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31914 Rev 31920
Line 1... Line 1...
1
package com.spice.profitmandi.service.scheme;
1
package com.spice.profitmandi.service.scheme;
2
 
2
 
3
import com.spice.profitmandi.dao.entity.fofo.OfferPayout;
3
import com.spice.profitmandi.dao.entity.fofo.OfferPayout;
4
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
4
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
-
 
5
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
-
 
6
import com.spice.profitmandi.dao.model.AmountModel;
5
 
7
 
6
import java.util.List;
8
import java.util.List;
7
import java.util.Objects;
9
import java.util.Objects;
8
import java.util.stream.Collectors;
10
import java.util.stream.Collectors;
9
 
11
 
Line 16... Line 18...
16
    private double percentageAmount;
18
    private double percentageAmount;
17
    private double paidAmount;
19
    private double paidAmount;
18
    private double dp;
20
    private double dp;
19
 
21
 
20
 
22
 
-
 
23
    public double getRolloutAmount(AmountModel amountModel) {
-
 
24
        double rollout = 0;
-
 
25
        if (amountModel.getAmountType().equals(AmountType.PERCENTAGE)) {
-
 
26
            double effectiveDp = this.getDp() - this.getFixedAmount();
-
 
27
            double totalPercentage = this.getPercentageAmount() + amountModel.getAmount();
-
 
28
            rollout = effectiveDp * (totalPercentage / (100 + totalPercentage) - (this.getPercentageAmount() / (100 + this.getPercentageAmount())));
-
 
29
        } else {
-
 
30
            rollout = amountModel.getAmount() * (100 / (100 + this.getPercentageAmount()));
-
 
31
        }
-
 
32
        return rollout;
-
 
33
    }
-
 
34
 
21
    public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> schemePayouts, List<OfferPayout> offerPayouts) {
35
    public InventoryPayoutModel(int inventoryItemId, List<SchemeInOut> schemePayouts, List<OfferPayout> offerPayouts) {
22
        this.inventoryItemId = inventoryItemId;
36
        this.inventoryItemId = inventoryItemId;
23
        this.schemePayouts = schemePayouts;
37
        this.schemePayouts = schemePayouts;
24
        this.offerPayouts = offerPayouts;
38
        this.offerPayouts = offerPayouts;
25
    }
39
    }