Subversion Repositories SmartDukaan

Rev

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

Rev 29934 Rev 30053
Line 352... Line 352...
352
		long grnPendingValue = grnPendingLineItemIds.stream()
352
		long grnPendingValue = grnPendingLineItemIds.stream()
353
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
353
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
354
		model.addAttribute("grnPendingCount", grnPendingCount);
354
		model.addAttribute("grnPendingCount", grnPendingCount);
355
		model.addAttribute("grnPendingValue", grnPendingValue);
355
		model.addAttribute("grnPendingValue", grnPendingValue);
356
 
356
 
357
 
-
 
358
		long submittedCount = submittedLineItemIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
357
		long submittedCount = submittedLineItemIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
359
		long submittedValue = submittedLineItemIds.stream()
358
		long submittedValue = submittedLineItemIds.stream()
360
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
359
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
361
		model.addAttribute("submittedCount", submittedCount);
360
		model.addAttribute("submittedCount", submittedCount);
362
		model.addAttribute("submittedValue", submittedValue);
361
		model.addAttribute("submittedValue", submittedValue);
Line 372... Line 371...
372
		LOGGER.info("shippedCount {}", shippedCount);
371
		LOGGER.info("shippedCount {}", shippedCount);
373
		long shippedValue = shippedOrderIds.stream()
372
		long shippedValue = shippedOrderIds.stream()
374
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
373
				.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
375
		model.addAttribute("shippedValue", shippedValue);
374
		model.addAttribute("shippedValue", shippedValue);
376
 
375
 
-
 
376
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
-
 
377
 
-
 
378
		LocalDateTime currentMonthStart = curDate.withDayOfMonth(1);
-
 
379
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
-
 
380
		LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
-
 
381
		
-
 
382
 
-
 
383
		LOGGER.info("lastMonthStart" + lastMonthStart);
-
 
384
		LOGGER.info("currentMonthEnd" + currentMonthEnd);
-
 
385
 
377
		model.addAttribute("countOrder", countOrder);
386
		model.addAttribute("countOrder", countOrder);
378
		model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
387
		model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
379
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
388
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
380
		model.addAttribute("isAdmin", isAdmin);
389
		model.addAttribute("isAdmin", isAdmin);
381
 
390
 
Line 391... Line 400...
391
				fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
400
				fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
392
				if (!fofoStore.isActive()) {
401
				if (!fofoStore.isActive()) {
393
					return "redirect:/login";
402
					return "redirect:/login";
394
				}
403
				}
395
 
404
 
-
 
405
				long pendingIncome = 0;
-
 
406
				long partnerPurchaseIn = 0;
-
 
407
				long partnerCreditedSale = 0;
-
 
408
				long partnerFrontIncome = 0;
-
 
409
				
-
 
410
				LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
411
				LocalDateTime currentStartMonth = LocalDate.now().atStartOfDay().withDayOfMonth(1);
-
 
412
				
-
 
413
				AllPurchaseInventoryModel partnerlPendingSaleAmount = schemeInOutRepository
-
 
414
						.selectAllPendingSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth,
-
 
415
								currentDate);
-
 
416
				AllPurchaseInventoryModel partnerCreditedSaleAmount = schemeInOutRepository
-
 
417
						.selectAllCreditedSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth,
-
 
418
								currentDate);
-
 
419
				AllPurchaseInventoryModel partnerPurchaseInAmount = schemeInOutRepository
-
 
420
						.selectAllPurchaseInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
421
 
-
 
422
				AllPurchaseInventoryModel partnerFrontIncomes = schemeInOutRepository
-
 
423
						.selectFrontIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
424
 
-
 
425
				LOGGER.info("partnerfrontIncomes" + partnerFrontIncomes);
-
 
426
 
-
 
427
				LOGGER.info("partnerCreditedSaleAmount" + partnerCreditedSaleAmount);
-
 
428
				LOGGER.info("partnerPurchaseInAmount" + partnerPurchaseInAmount);
-
 
429
				LOGGER.info("partnerlPendingSaleAmount" + partnerlPendingSaleAmount);
-
 
430
 
-
 
431
				if (partnerlPendingSaleAmount != null) {
-
 
432
 
-
 
433
					pendingIncome = partnerlPendingSaleAmount.getAmount();
-
 
434
 
-
 
435
					LOGGER.info("pendingIncome" + pendingIncome);
-
 
436
 
-
 
437
				}
-
 
438
 
-
 
439
				if (partnerCreditedSaleAmount != null) {
-
 
440
 
-
 
441
					partnerCreditedSale = partnerCreditedSaleAmount.getAmount();
-
 
442
 
-
 
443
					LOGGER.info("partnerCreditedSale" + partnerCreditedSale);
-
 
444
 
-
 
445
				}
-
 
446
				if (partnerFrontIncomes != null) {
-
 
447
 
-
 
448
					partnerFrontIncome = partnerFrontIncomes.getAmount();
-
 
449
					LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
450
 
-
 
451
				}
-
 
452
				if (partnerPurchaseInAmount != null) {
-
 
453
 
-
 
454
					partnerPurchaseIn = partnerPurchaseInAmount.getAmount();
-
 
455
					LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
456
 
-
 
457
				}
-
 
458
 
-
 
459
				LOGGER.info("partnerPurchaseInTT" + partnerPurchaseIn);
-
 
460
				LOGGER.info("partnerCreditedSaleTT" + partnerCreditedSale);
-
 
461
				LOGGER.info("pendingIncomeTT" + pendingIncome);
-
 
462
 
-
 
463
				long totalIncome = partnerCreditedSale + partnerPurchaseIn + pendingIncome + partnerFrontIncome;
-
 
464
 
-
 
465
				long creditedIncome = partnerCreditedSale + partnerPurchaseIn + partnerFrontIncome;
-
 
466
 
-
 
467
				long pendingTotalIncome = pendingIncome;
-
 
468
				LOGGER.info("totalIncome" + totalIncome);
-
 
469
				LOGGER.info("creditedIncome" + creditedIncome);
-
 
470
				LOGGER.info("pendingTotalIncome" + pendingTotalIncome);
-
 
471
 
-
 
472
				model.addAttribute("totalIncome", totalIncome);
-
 
473
				model.addAttribute("creditedIncome", creditedIncome);
-
 
474
				model.addAttribute("pendingTotalIncome", pendingTotalIncome);
-
 
475
 
396
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
476
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
397
				model.addAttribute("partnerType", partnerType);
477
				model.addAttribute("partnerType", partnerType);
398
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
478
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
399
				model.addAttribute("fofoStore", fofoStore);
479
				model.addAttribute("fofoStore", fofoStore);
400
				model.addAttribute("partnerType", partnerType);
480
				model.addAttribute("partnerType", partnerType);
Line 404... Line 484...
404
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
484
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
405
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
485
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
406
						.append("partnerId", fofoStore.getId()).toString());
486
						.append("partnerId", fofoStore.getId()).toString());
407
				model.addAttribute("activatedImeis",
487
				model.addAttribute("activatedImeis",
408
						inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
488
						inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
409
				LocalDateTime curDate = LocalDate.now().atStartOfDay();
-
 
-
 
489
 
410
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
490
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
411
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
491
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
412
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
492
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
413
 
493
 
414
				Double accesoriesStock = currentInventorySnapshotRepository
494
				Double accesoriesStock = currentInventorySnapshotRepository
Line 435... Line 515...
435
				LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
515
				LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
436
 
516
 
437
			}
517
			}
438
		}
518
		}
439
 
519
 
440
		LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
-
 
441
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
-
 
442
		LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
-
 
443
		double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
520
		double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
444
				currentMonthEnd) / 2;
521
				currentMonthEnd) / 2;
445
		double lastMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), lastMonthStart,
522
		double lastMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), lastMonthStart,
446
				currentMonthStart) / 2;
523
				currentMonthStart) / 2;
447
		double ratingTillDate = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), LocalDateTime.MIN,
524
		double ratingTillDate = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), LocalDateTime.MIN,