| Line 43... |
Line 43... |
| 43 |
import com.spice.profitmandi.common.model.CustomFofoOrderItem;
|
43 |
import com.spice.profitmandi.common.model.CustomFofoOrderItem;
|
| 44 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
44 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
| 45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 46 |
import com.spice.profitmandi.common.model.GadgetCopsInsuranceModel;
|
46 |
import com.spice.profitmandi.common.model.GadgetCopsInsuranceModel;
|
| 47 |
import com.spice.profitmandi.common.model.GstRate;
|
47 |
import com.spice.profitmandi.common.model.GstRate;
|
| - |
|
48 |
import com.spice.profitmandi.common.model.MopPriceModel;
|
| 48 |
import com.spice.profitmandi.common.model.PdfModel;
|
49 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 49 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
50 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 50 |
import com.spice.profitmandi.common.model.SerialNumberDetail;
|
51 |
import com.spice.profitmandi.common.model.SerialNumberDetail;
|
| 51 |
import com.spice.profitmandi.common.util.InsuranceUtils;
|
52 |
import com.spice.profitmandi.common.util.InsuranceUtils;
|
| 52 |
import com.spice.profitmandi.common.util.PdfUtils;
|
53 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| Line 238... |
Line 239... |
| 238 |
continue;
|
239 |
continue;
|
| 239 |
}
|
240 |
}
|
| 240 |
cf.setDisplayName(getValidName(i.getBrand())+" "+getValidName(i.getModelName())+" "+getValidName(i.getModelNumber())+" "+getValidName(i.getColor()).replaceAll("\\s+", " "));
|
241 |
cf.setDisplayName(getValidName(i.getBrand())+" "+getValidName(i.getModelName())+" "+getValidName(i.getModelNumber())+" "+getValidName(i.getColor()).replaceAll("\\s+", " "));
|
| 241 |
cf.setItemType(i.getType());
|
242 |
cf.setItemType(i.getType());
|
| 242 |
}
|
243 |
}
|
| 243 |
Map<Integer, Float> mopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, loginDetails.getFofoId());
|
244 |
Map<Integer, MopPriceModel> mopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, loginDetails.getFofoId());
|
| 244 |
LOGGER.info("mopPriceMap {}", mopPriceMap);
|
245 |
LOGGER.info("mopPriceMap {}", mopPriceMap);
|
| 245 |
model.addAttribute("cartObj", cartItems);
|
246 |
model.addAttribute("cartObj", cartItems);
|
| 246 |
model.addAttribute("mopPriceMap", mopPriceMap);
|
247 |
model.addAttribute("mopPriceMap", mopPriceMap);
|
| 247 |
return "order-index";
|
248 |
return "order-index";
|
| 248 |
}catch (Exception e) {
|
249 |
}catch (Exception e) {
|
| Line 638... |
Line 639... |
| 638 |
}
|
639 |
}
|
| 639 |
}
|
640 |
}
|
| 640 |
|
641 |
|
| 641 |
// mop price validation
|
642 |
// mop price validation
|
| 642 |
Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
|
643 |
Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
|
| 643 |
Map<Integer, Float> itemIdMopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, fofoDetails.getFofoId());
|
644 |
Map<Integer, MopPriceModel> itemIdMopPriceMap = pricingService.getPurchasePriceMopPriceNotFound(itemIds, fofoDetails.getFofoId());
|
| 644 |
for(Map.Entry<Integer, Float> entry : itemIdMopPriceMap.entrySet()){
|
645 |
for(Map.Entry<Integer, MopPriceModel> entry : itemIdMopPriceMap.entrySet()){
|
| 645 |
CustomFofoLineItem customFofoLineItem = customFofoLineItemMap.get(entry.getKey());
|
646 |
CustomFofoLineItem customFofoLineItem = customFofoLineItemMap.get(entry.getKey());
|
| 646 |
if(entry.getValue() < Float.MAX_VALUE && customFofoLineItem.getSellingPrice() < entry.getValue()){
|
647 |
if(entry.getValue().getPrice() < Float.MAX_VALUE && customFofoLineItem.getSellingPrice() < entry.getValue().getPrice()){
|
| 647 |
invalidMopItemIdPriceMap.put(entry.getKey(), customFofoLineItem.getSellingPrice());
|
648 |
invalidMopItemIdPriceMap.put(entry.getKey(), customFofoLineItem.getSellingPrice());
|
| 648 |
}
|
649 |
}
|
| 649 |
}
|
650 |
}
|
| 650 |
|
651 |
|
| 651 |
if(!invalidMopItemIdPriceMap.isEmpty()){
|
652 |
if(!invalidMopItemIdPriceMap.isEmpty()){
|
| Line 834... |
Line 835... |
| 834 |
|
835 |
|
| 835 |
Map<Float, Float> invalidInsuranceMarginAmount = new HashMap<>();
|
836 |
Map<Float, Float> invalidInsuranceMarginAmount = new HashMap<>();
|
| 836 |
|
837 |
|
| 837 |
for(Map.Entry<String, Float> entry : insuranceSerialNumberItemPrice.entrySet()){
|
838 |
for(Map.Entry<String, Float> entry : insuranceSerialNumberItemPrice.entrySet()){
|
| 838 |
int itemId = this.getItemIdFromSerialNumber(itemIdSerialNumbers, entry.getKey());
|
839 |
int itemId = this.getItemIdFromSerialNumber(itemIdSerialNumbers, entry.getKey());
|
| 839 |
float itemPurchasePrice = itemIdMopPriceMap.get(itemId);
|
840 |
float itemPurchasePrice = itemIdMopPriceMap.get(itemId).getPrice();
|
| 840 |
float itemSellingPrice = entry.getValue();
|
841 |
float itemSellingPrice = entry.getValue();
|
| 841 |
float itemMargin = itemSellingPrice - itemPurchasePrice;
|
842 |
float itemMargin = itemSellingPrice - itemPurchasePrice;
|
| 842 |
float insurancePurchasePrice = insurancePricesMap.get(entry.getValue()).getDealerPrice();
|
843 |
float insurancePurchasePrice = insurancePricesMap.get(entry.getValue()).getDealerPrice();
|
| 843 |
float insuranceSellingPrice = insuranceSerialNumberSaleAmount.get(entry.getKey());
|
844 |
float insuranceSellingPrice = insuranceSerialNumberSaleAmount.get(entry.getKey());
|
| 844 |
float insuranceMargin = insuranceSellingPrice - insurancePurchasePrice;
|
845 |
float insuranceMargin = insuranceSellingPrice - insurancePurchasePrice;
|
| Line 1115... |
Line 1116... |
| 1115 |
fofoOrders = fofoOrderRepository.selectByFofoId(loginDetails.getFofoId(),startDateTime, endDateTime, offset, limit);
|
1116 |
fofoOrders = fofoOrderRepository.selectByFofoId(loginDetails.getFofoId(),startDateTime, endDateTime, offset, limit);
|
| 1116 |
countItems = fofoOrderRepository.selectCount(loginDetails.getFofoId(), startDateTime, endDateTime, invoiceNumber, searchType);
|
1117 |
countItems = fofoOrderRepository.selectCount(loginDetails.getFofoId(), startDateTime, endDateTime, invoiceNumber, searchType);
|
| 1117 |
}
|
1118 |
}
|
| 1118 |
|
1119 |
|
| 1119 |
model.addAttribute("saleHistories", fofoOrders);
|
1120 |
model.addAttribute("saleHistories", fofoOrders);
|
| 1120 |
model.addAttribute("start",offset+1);
|
1121 |
model.addAttribute("start", offset + 1);
|
| 1121 |
model.addAttribute("size",countItems);
|
1122 |
model.addAttribute("size", countItems);
|
| 1122 |
model.addAttribute("searchType",searchType);
|
1123 |
model.addAttribute("searchType", searchType);
|
| 1123 |
model.addAttribute(ProfitMandiConstants.START_TIME, startTimeString);
|
1124 |
model.addAttribute(ProfitMandiConstants.START_TIME, startTimeString);
|
| 1124 |
model.addAttribute(ProfitMandiConstants.END_TIME, endTimeString);
|
1125 |
model.addAttribute(ProfitMandiConstants.END_TIME, endTimeString);
|
| 1125 |
if (fofoOrders.size() < limit){
|
1126 |
if (fofoOrders.size() < limit){
|
| 1126 |
model.addAttribute("end",offset + fofoOrders.size());
|
1127 |
model.addAttribute("end", offset + fofoOrders.size());
|
| 1127 |
}
|
1128 |
}
|
| 1128 |
else{
|
1129 |
else{
|
| 1129 |
model.addAttribute("end",offset+limit);
|
1130 |
model.addAttribute("end", offset + limit);
|
| 1130 |
}
|
1131 |
}
|
| 1131 |
|
1132 |
|
| 1132 |
return "sale-history";
|
1133 |
return "sale-history";
|
| 1133 |
}
|
1134 |
}
|
| 1134 |
|
1135 |
|