| Line 659... |
Line 659... |
| 659 |
return totalCashback;
|
659 |
return totalCashback;
|
| 660 |
}
|
660 |
}
|
| 661 |
|
661 |
|
| 662 |
@Override
|
662 |
@Override
|
| 663 |
public float getSpecialSupportAmount(float supportAmount, PartnerType partnerType, LocalDate onDate, int catalogId) throws ProfitMandiBusinessException {
|
663 |
public float getSpecialSupportAmount(float supportAmount, PartnerType partnerType, LocalDate onDate, int catalogId) throws ProfitMandiBusinessException {
|
| 664 |
float totalMargin = this.selectPercentageScheme(partnerType, onDate, catalogId, false, 0, 0).stream().collect(Collectors.summingDouble(x -> x.getAmount())).floatValue();
|
- |
|
| 665 |
int itemId = itemRepository.selectAllByCatalogItemId(catalogId).stream().findAny().get().getId();
|
664 |
int itemId = itemRepository.selectAllByCatalogItemId(catalogId).stream().findAny().get().getId();
|
| 666 |
float totalTaxRate = stateGstRateRepository.getTotalTaxRate(itemId);
|
665 |
float totalTaxRate = stateGstRateRepository.getTotalTaxRate(itemId);
|
| - |
|
666 |
return this.getSpecialSupportAmount(supportAmount, partnerType, onDate, catalogId, totalTaxRate);
|
| - |
|
667 |
}
|
| - |
|
668 |
|
| - |
|
669 |
@Override
|
| - |
|
670 |
public float getSpecialSupportAmount(float supportAmount, PartnerType partnerType, LocalDate onDate, int catalogId, float taxRate) throws ProfitMandiBusinessException {
|
| - |
|
671 |
float totalMargin = this.selectPercentageScheme(partnerType, onDate, catalogId, false, 0, 0).stream().collect(Collectors.summingDouble(x -> x.getAmount())).floatValue();
|
| 667 |
float amountToCredit = supportAmount * (1 - totalMargin / (100 + totalTaxRate));
|
672 |
float amountToCredit = supportAmount * (1 - totalMargin / (100 + taxRate));
|
| 668 |
return amountToCredit;
|
673 |
return amountToCredit;
|
| 669 |
}
|
674 |
}
|
| 670 |
|
675 |
|
| 671 |
private void processSpecialSupport(FofoOrder fofoOrder, List<Scheme> supportSchemes, InventoryItem inventoryItem, PartnerType partnerType, LocalDateTime saleDate) throws ProfitMandiBusinessException {
|
676 |
private void processSpecialSupport(FofoOrder fofoOrder, List<Scheme> supportSchemes, InventoryItem inventoryItem, PartnerType partnerType, LocalDateTime saleDate) throws ProfitMandiBusinessException {
|
| 672 |
int catalogId = inventoryItem.getItem().getCatalogItemId();
|
677 |
int catalogId = inventoryItem.getItem().getCatalogItemId();
|