Subversion Repositories SmartDukaan

Rev

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

Rev 30454 Rev 30463
Line 657... Line 657...
657
			}
657
			}
658
		}
658
		}
659
		return totalCashback;
659
		return totalCashback;
660
	}
660
	}
661
 
661
 
-
 
662
	@Override
-
 
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();
-
 
666
		float totalTaxRate = stateGstRateRepository.getTotalTaxRate(itemId);
-
 
667
		float amountToCredit = supportAmount * (1 - totalMargin / (100 + totalTaxRate));
-
 
668
		return amountToCredit;
-
 
669
	}
-
 
670
 
662
	private void processSpecialSupport(FofoOrder fofoOrder, List<Scheme> supportSchemes, InventoryItem inventoryItem, PartnerType partnerType, LocalDateTime saleDate) throws ProfitMandiBusinessException {
671
	private void processSpecialSupport(FofoOrder fofoOrder, List<Scheme> supportSchemes, InventoryItem inventoryItem, PartnerType partnerType, LocalDateTime saleDate) throws ProfitMandiBusinessException {
663
		int catalogId = inventoryItem.getItem().getCatalogItemId();
672
		int catalogId = inventoryItem.getItem().getCatalogItemId();
664
		float totalMargin = this.selectPercentageScheme(partnerType, saleDate.toLocalDate(), catalogId, false, 0, 0).stream().collect(Collectors.summingDouble(x -> x.getAmount())).floatValue();
673
		float totalMargin = this.selectPercentageScheme(partnerType, saleDate.toLocalDate(), catalogId, false, 0, 0).stream().collect(Collectors.summingDouble(x -> x.getAmount())).floatValue();
665
		LOGGER.info("total percentage margin - {}", totalMargin);
674
		LOGGER.info("total percentage margin - {}", totalMargin);
666
		float totalTaxRate = 0;
675
		float totalTaxRate = 0;