| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.net.URISyntaxException;
|
4 |
import java.net.URISyntaxException;
|
| - |
|
5 |
import java.time.LocalDateTime;
|
| 5 |
import java.util.List;
|
6 |
import java.util.List;
|
| 6 |
|
7 |
|
| 7 |
import javax.servlet.http.HttpServletRequest;
|
8 |
import javax.servlet.http.HttpServletRequest;
|
| 8 |
|
9 |
|
| 9 |
import org.apache.logging.log4j.LogManager;
|
10 |
import org.apache.logging.log4j.LogManager;
|
| Line 24... |
Line 25... |
| 24 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
25 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 25 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
26 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 26 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
27 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
28 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
29 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| - |
|
30 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
31 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
32 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 31 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
33 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 32 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
34 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 33 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
35 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
| Line 66... |
Line 68... |
| 66 |
private WalletService walletService;
|
68 |
private WalletService walletService;
|
| 67 |
|
69 |
|
| 68 |
@Autowired
|
70 |
@Autowired
|
| 69 |
private InventoryService inventoryService;
|
71 |
private InventoryService inventoryService;
|
| 70 |
|
72 |
|
| 71 |
@Autowired
|
- |
|
| 72 |
private TargetSlabService targetSlabService;
|
- |
|
| 73 |
|
73 |
|
| 74 |
@Autowired
|
74 |
@Autowired
|
| 75 |
private OrderRepository orderRepository;
|
75 |
private OrderRepository orderRepository;
|
| 76 |
|
76 |
|
| 77 |
@Autowired
|
77 |
@Autowired
|
| 78 |
private PurchaseReturnItemRepository purchaseReturnItemRepository;
|
78 |
private FofoOrderRepository fofoOrderRepository;
|
| 79 |
|
79 |
|
| 80 |
/*
|
80 |
/*
|
| 81 |
* @Autowired private ScanRepository scanRepository;
|
81 |
* @Autowired private ScanRepository scanRepository;
|
| 82 |
*/
|
82 |
*/
|
| 83 |
|
83 |
|
| Line 113... |
Line 113... |
| 113 |
float unbilledStockAmount = 0;
|
113 |
float unbilledStockAmount = 0;
|
| 114 |
float grnPendingStockAmount = 0;
|
114 |
float grnPendingStockAmount = 0;
|
| 115 |
float shortPercentage = 100;
|
115 |
float shortPercentage = 100;
|
| 116 |
float totalInvestedAmount = 0;
|
116 |
float totalInvestedAmount = 0;
|
| 117 |
float minimumInvestment = 0;
|
117 |
float minimumInvestment = 0;
|
| 118 |
float returnedStockInTransit=0;
|
118 |
float returnedStockInTransit = 0;
|
| 119 |
double sale=0;
|
119 |
double sale=0;
|
| 120 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
120 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 121 |
model.addAttribute("showAlert", false);
|
121 |
model.addAttribute("showAlert", false);
|
| - |
|
122 |
model.addAttribute("sale",sale);
|
| 122 |
} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
|
123 |
} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
|
| 123 |
walletAmount = walletService.getUserWallet(loginDetails.getFofoId()).getAmount();
|
124 |
walletAmount = walletService.getUserWallet(loginDetails.getFofoId()).getAmount();
|
| 124 |
inStockAmount = inventoryService.getTotalAmountInStock(loginDetails.getFofoId());
|
125 |
inStockAmount = inventoryService.getTotalAmountInStock(loginDetails.getFofoId());
|
| - |
|
126 |
sale=fofoOrderRepository.selectTotalSaleSumByFofoIdBrtweenDate(loginDetails.getFofoId(), LocalDateTime.of(LocalDateTime.now().getYear(), LocalDateTime.now().getMonth(),01, 00, 00), LocalDateTime.now());
|
| 125 |
|
127 |
|
| 126 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(loginDetails.getFofoId());
|
128 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(loginDetails.getFofoId());
|
| 127 |
for (Order unBilledOrder : unbilledOrders) {
|
129 |
for (Order unBilledOrder : unbilledOrders) {
|
| 128 |
unbilledStockAmount += unBilledOrder.getTotalAmount();
|
130 |
unbilledStockAmount += unBilledOrder.getTotalAmount();
|
| 129 |
}
|
131 |
}
|
| 130 |
|
132 |
|
| Line 138... |
Line 140... |
| 138 |
model.addAttribute("showAlert", shortPercentage > 10);
|
140 |
model.addAttribute("showAlert", shortPercentage > 10);
|
| 139 |
minimumInvestment = fofoStore.getMinimumInvestment();
|
141 |
minimumInvestment = fofoStore.getMinimumInvestment();
|
| 140 |
|
142 |
|
| 141 |
//debitNoteRepository.se
|
143 |
//debitNoteRepository.se
|
| 142 |
}
|
144 |
}
|
| 143 |
model.addAttribute("sale", sale);
|
- |
|
| 144 |
model.addAttribute("walletAmount", walletAmount);
|
145 |
model.addAttribute("walletAmount", walletAmount);
|
| 145 |
model.addAttribute("inStockAmount", inStockAmount);
|
146 |
model.addAttribute("inStockAmount", inStockAmount);
|
| 146 |
model.addAttribute("unbilledStockAmount", unbilledStockAmount);
|
147 |
model.addAttribute("unbilledStockAmount", unbilledStockAmount);
|
| 147 |
model.addAttribute("grnPendingStockAmount", grnPendingStockAmount);
|
148 |
model.addAttribute("grnPendingStockAmount", grnPendingStockAmount);
|
| 148 |
model.addAttribute("shortPercentage", shortPercentage);
|
149 |
model.addAttribute("shortPercentage", shortPercentage);
|
| Line 158... |
Line 159... |
| 158 |
model.addAttribute("webApiPort", webApiPort);
|
159 |
model.addAttribute("webApiPort", webApiPort);
|
| 159 |
model.addAttribute("webApiScheme", webApiScheme);
|
160 |
model.addAttribute("webApiScheme", webApiScheme);
|
| 160 |
model.addAttribute("webApiRoot", webApiRoot);
|
161 |
model.addAttribute("webApiRoot", webApiRoot);
|
| 161 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
162 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
| 162 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
163 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| - |
|
164 |
model.addAttribute("sale", sale);
|
| 163 |
|
165 |
|
| 164 |
List<NotificationData> notificationData = null;
|
166 |
List<NotificationData> notificationData = null;
|
| 165 |
long size = 0;
|
167 |
long size = 0;
|
| 166 |
|
168 |
|
| 167 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|
169 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|