Subversion Repositories SmartDukaan

Rev

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

Rev 27556 Rev 27574
Line 37... Line 37...
37
import org.springframework.ui.Model;
37
import org.springframework.ui.Model;
38
import org.springframework.web.bind.annotation.RequestMapping;
38
import org.springframework.web.bind.annotation.RequestMapping;
39
import org.springframework.web.bind.annotation.RequestMethod;
39
import org.springframework.web.bind.annotation.RequestMethod;
40
import org.springframework.web.bind.annotation.RequestParam;
40
import org.springframework.web.bind.annotation.RequestParam;
41
 
41
 
-
 
42
import com.fasterxml.jackson.databind.ObjectMapper;
42
import com.google.gson.Gson;
43
import com.google.gson.Gson;
43
import com.mongodb.DBObject;
44
import com.mongodb.DBObject;
44
import com.spice.profitmandi.common.enumuration.ContentType;
45
import com.spice.profitmandi.common.enumuration.ContentType;
45
import com.spice.profitmandi.common.enumuration.MessageType;
46
import com.spice.profitmandi.common.enumuration.MessageType;
46
import com.spice.profitmandi.common.enumuration.ReporticoProject;
47
import com.spice.profitmandi.common.enumuration.ReporticoProject;
Line 411... Line 412...
411
			LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
412
			LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
412
			int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
413
			int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
413
			double monthSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth,
414
			double monthSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth,
414
					startOfMonth.plusMonths(1), loginDetails.getFofoId(), false).get(fofoId);
415
					startOfMonth.plusMonths(1), loginDetails.getFofoId(), false).get(fofoId);
415
 
416
 
-
 
417
			double mtdSales = fofoOrderItemRepository
416
			double mtdSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth,
418
					.selectSumMopGroupByRetailer(startOfMonth,
417
					startOfMonth.plusDays(Math.min(dayOfMonth, lengthOfMonth)), loginDetails.getFofoId(), false).get(fofoId);
419
							startOfMonth.plusDays(Math.min(dayOfMonth, lengthOfMonth)), loginDetails.getFofoId(), false)
-
 
420
					.get(fofoId);
418
 
421
 
419
			PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfMonth.toLocalDate());
422
			PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfMonth.toLocalDate());
420
 
423
 
421
			MonthSaleModel ms = new MonthSaleModel();
424
			MonthSaleModel ms = new MonthSaleModel();
422
			ms.setMtdSales(this.format((long) mtdSales));
425
			ms.setMtdSales(this.format((long) mtdSales));
Line 874... Line 877...
874
				model.addAttribute("authId", authUser.getId());
877
				model.addAttribute("authId", authUser.getId());
875
 
878
 
876
			}
879
			}
877
			LOGGER.info("warehouseMap" + wm);
880
			LOGGER.info("warehouseMap" + wm);
878
			model.addAttribute("reporticoDate", rct);
881
			model.addAttribute("reporticoDate", rct);
879
 
-
 
-
 
882
			LOGGER.info("warehousePartnersSales" + warehousePartnersSales);
880
			model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
883
			model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
881
			model.addAttribute("warehouseMap", wm);
884
			model.addAttribute("warehouseMap", wm);
882
			model.addAttribute("warehouseStockMap", warehouseStockMap);
885
			model.addAttribute("warehouseStockMap", warehouseStockMap);
883
			model.addAttribute("brandSales", warehousePartnersSales);
886
			model.addAttribute("brandSales", warehousePartnersSales);
884
 
887
 
Line 1388... Line 1391...
1388
 
1391
 
1389
		long lmtd = 0;
1392
		long lmtd = 0;
1390
		long lmtdQty = 0;
1393
		long lmtdQty = 0;
1391
		long mtd = 0;
1394
		long mtd = 0;
1392
		long mtdQty = 0;
1395
		long mtdQty = 0;
-
 
1396
		long lms = 0;
-
 
1397
		long lmsQty = 0;
-
 
1398
		;
1393
		if (!warehousePartnersSales.isEmpty()) {
1399
		if (!warehousePartnersSales.isEmpty()) {
1394
 
1400
 
1395
			for (WarehouseWisePartnerSaleModel sale : warehousePartnersSales) {
1401
			for (WarehouseWisePartnerSaleModel sale : warehousePartnersSales) {
1396
				lmtd += sale.getLmtd();
1402
				lmtd += sale.getLmtd();
1397
				lmtdQty += sale.getLmtdQty();
1403
				lmtdQty += sale.getLmtdQty();
1398
				mtd += sale.getMtd();
1404
				mtd += sale.getMtd();
1399
				mtdQty += sale.getMtdQty();
1405
				mtdQty += sale.getMtdQty();
-
 
1406
				lms += sale.getLms();
-
 
1407
				lmsQty += sale.getLmsQty();
1400
			}
1408
			}
1401
 
1409
 
1402
			WarehouseWisePartnerSaleModel wp = new WarehouseWisePartnerSaleModel();
1410
			WarehouseWisePartnerSaleModel wp = new WarehouseWisePartnerSaleModel();
1403
			wp.setLmtd(lmtd);
1411
			wp.setLmtd(lmtd);
1404
			wp.setLmtdQty(lmtdQty);
1412
			wp.setLmtdQty(lmtdQty);
1405
			wp.setMtd(mtd);
1413
			wp.setMtd(mtd);
1406
			wp.setMtdQty(mtdQty);
1414
			wp.setMtdQty(mtdQty);
-
 
1415
			wp.setLms(lms);
-
 
1416
			wp.setLmsQty(lmsQty);
-
 
1417
 
1407
			wp.setWarehouseId(0);
1418
			wp.setWarehouseId(0);
1408
			warehousePartnersSales.add(wp);
1419
			warehousePartnersSales.add(wp);
1409
			warehousePartnersSalesMap.put(0, wp);
1420
			warehousePartnersSalesMap.put(0, wp);
1410
		}
1421
		}
1411
		return warehousePartnersSalesMap;
1422
		return warehousePartnersSalesMap;