| Line 41... |
Line 41... |
| 41 |
import com.spice.profitmandi.common.model.SchemeModel;
|
41 |
import com.spice.profitmandi.common.model.SchemeModel;
|
| 42 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
42 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 43 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
43 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 44 |
import com.spice.profitmandi.common.util.StringUtils;
|
44 |
import com.spice.profitmandi.common.util.StringUtils;
|
| 45 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
45 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
46 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 46 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
47 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
| 47 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
48 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 48 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
49 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 49 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
50 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 50 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
51 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
| Line 81... |
Line 82... |
| 81 |
|
82 |
|
| 82 |
@Autowired
|
83 |
@Autowired
|
| 83 |
private StateGstRateRepository stateGstRateRepository;
|
84 |
private StateGstRateRepository stateGstRateRepository;
|
| 84 |
|
85 |
|
| 85 |
@Autowired
|
86 |
@Autowired
|
| - |
|
87 |
private ItemRepository itemRepository;
|
| - |
|
88 |
|
| - |
|
89 |
@Autowired
|
| 86 |
private SchemeRepository schemeRepository;
|
90 |
private SchemeRepository schemeRepository;
|
| 87 |
|
91 |
|
| 88 |
@Autowired
|
92 |
@Autowired
|
| 89 |
private SchemeItemRepository schemeItemRepository;
|
93 |
private SchemeItemRepository schemeItemRepository;
|
| 90 |
|
94 |
|
| Line 339... |
Line 343... |
| 339 |
throw new ProfitMandiBusinessException("SchemeId", searchTerm, "SchemeId Not Found");
|
343 |
throw new ProfitMandiBusinessException("SchemeId", searchTerm, "SchemeId Not Found");
|
| 340 |
}
|
344 |
}
|
| 341 |
} else {
|
345 |
} else {
|
| 342 |
int itemId = 0;
|
346 |
int itemId = 0;
|
| 343 |
TagListing tagListing = null;
|
347 |
TagListing tagListing = null;
|
| 344 |
tagListing = tagListingRepository.selectByItemId(itemId);
|
- |
|
| 345 |
if (!searchItem.equals("")) {
|
348 |
if (!searchItem.equals("")) {
|
| 346 |
itemId = Integer.parseInt(searchItem);
|
349 |
itemId = Integer.parseInt(searchItem);
|
| 347 |
tagListing = tagListingRepository.selectByItemId(itemId);
|
350 |
tagListing = tagListingRepository.selectByItemId(itemId);
|
| - |
|
351 |
if(tagListing==null) {
|
| - |
|
352 |
Item item = itemRepository.selectById(itemId);
|
| - |
|
353 |
throw new ProfitMandiBusinessException(item.getItemDescription(), "Could not find scheme", "Could not find scheme");
|
| - |
|
354 |
}
|
| 348 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
355 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
| 349 |
model.addAttribute("mop", tagListing.getMop());
|
356 |
model.addAttribute("mop", tagListing.getMop());
|
| 350 |
}
|
357 |
}
|
| 351 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, itemId, isAdmin, offset, limit);
|
358 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, itemId, isAdmin, offset, limit);
|
| 352 |
for(Scheme scheme : schemes) {
|
359 |
for(Scheme scheme : schemes) {
|
| 353 |
if(scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
360 |
if(scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| 354 |
if(itemId > 0) {
|
361 |
if(tagListing != null) {
|
| 355 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
362 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
| 356 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
363 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
| 357 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
364 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
| 358 |
scheme.setAmountModel(FormattingUtils.formatDecimalTwoDigits(amount) +" ("+ scheme.getAmount() + "%)");
|
365 |
scheme.setAmountModel(FormattingUtils.formatDecimalTwoDigits(amount) +" ("+ scheme.getAmount() + "%)");
|
| 359 |
} else {
|
366 |
} else {
|