Subversion Repositories SmartDukaan

Rev

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

Rev 31284 Rev 31286
Line 1150... Line 1150...
1150
				LastMonthBrandWiseIncomeModel lmbwIncomeModel = new LastMonthBrandWiseIncomeModel();
1150
				LastMonthBrandWiseIncomeModel lmbwIncomeModel = new LastMonthBrandWiseIncomeModel();
1151
				lmbwIncomeModel.setModelName(x.getModelName());
1151
				lmbwIncomeModel.setModelName(x.getModelName());
1152
				lmbwIncomeModel.setModelNumber(x.getModelNumber());
1152
				lmbwIncomeModel.setModelNumber(x.getModelNumber());
1153
				lmbwIncomeModel.setBrand(x.getBrand());
1153
				lmbwIncomeModel.setBrand(x.getBrand());
1154
				lmbwIncomeModel.setCatalogItemId(x.getCatalogItemId());
1154
				lmbwIncomeModel.setCatalogItemId(x.getCatalogItemId());
1155
				lmbwIncomeModel.setStatus(SchemePayoutStatus.CREDITED);
-
 
1156
				modelWiseSchemeOutMarginsMap.put(x.getCatalogItemId(), lmbwIncomeModel);
1155
				modelWiseSchemeOutMarginsMap.put(x.getCatalogItemId(), lmbwIncomeModel);
1157
			}
1156
			}
1158
			LastMonthBrandWiseIncomeModel lmbwIncomeModel = modelWiseSchemeOutMarginsMap.get(x.getCatalogItemId());
1157
			LastMonthBrandWiseIncomeModel lmbwIncomeModel = modelWiseSchemeOutMarginsMap.get(x.getCatalogItemId());
1159
			lmbwIncomeModel.setQty(lmbwIncomeModel.getQty() + x.getQty());
1158
			lmbwIncomeModel.setQty(lmbwIncomeModel.getQty() + x.getQty());
1160
			lmbwIncomeModel.setAmount(lmbwIncomeModel.getAmount() + x.getAmount());
1159
			lmbwIncomeModel.setAmount(lmbwIncomeModel.getAmount() + x.getAmount());
Line 1248... Line 1247...
1248
			}
1247
			}
1249
 
1248
 
1250
		});
1249
		});
1251
		Map<String, Float> totalAmountMap = lastMonthSaleMarginMap.entrySet().stream()
1250
		Map<String, Float> totalAmountMap = lastMonthSaleMarginMap.entrySet().stream()
1252
				.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue().getAmount()));
1251
				.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue().getAmount()));
1253
		Set<String> keySet = new HashSet<String>();
1252
		Set<String> brandSet = new HashSet<>();
1254
		keySet.addAll(lastMonthPurchaseInMarginMap.keySet());
1253
		brandSet.addAll(lastMonthPurchaseInMarginMap.keySet());
1255
		keySet.addAll(lastMonthSaleMarginMap.keySet());
1254
		brandSet.addAll(lastMonthSaleMarginMap.keySet());
1256
 
-
 
-
 
1255
		brandSet.addAll(lastMonthPendingIncomeMap.keySet());
1257
		lastMonthPurchaseInMarginMap.entrySet().stream().forEach(x -> {
1256
		brandSet.stream().forEach(x -> {
1258
			String brand = x.getKey();
1257
			totalAmountMap.put(x,
1259
			float amount = x.getValue().getAmount();
1258
					(lastMonthSaleMarginMap.get(x) == null ? 0 : lastMonthSaleMarginMap.get(x).getAmount()) +
1260
			if (!totalAmountMap.containsKey(brand)) {
1259
							(lastMonthPurchaseInMarginMap.get(x) == null ? 0 : lastMonthPurchaseInMarginMap.get(x).getAmount()) +
1261
				totalAmountMap.put(brand, 0f);
1260
							(lastMonthPendingIncomeMap.get(x) == null ? 0 : lastMonthPendingIncomeMap.get(x).getAmount())
1262
			}
1261
			);
1263
			totalAmountMap.put(brand, totalAmountMap.get(brand) + amount);
-
 
1264
 
-
 
1265
		});
1262
		});
1266
 
1263
 
1267
		Map<Integer, String> monthValueMap = new HashMap<>();
1264
		Map<Integer, String> monthValueMap = new HashMap<>();
1268
		for (int i = 0; i <= 5; i++) {
1265
		for (int i = 0; i <= 5; i++) {
1269
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
1266
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
1270
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
1267
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
1271
		}
1268
		}
1272
		model.addAttribute("monthValueMap", monthValueMap);
1269
		model.addAttribute("monthValueMap", monthValueMap);
1273
 
1270
 
1274
		model.addAttribute("keySet", keySet);
1271
		model.addAttribute("keySet", brandSet);
1275
		model.addAttribute("lastMonthPurchaseInMarginMap", lastMonthPurchaseInMarginMap);
1272
		model.addAttribute("lastMonthPurchaseInMarginMap", lastMonthPurchaseInMarginMap);
1276
		model.addAttribute("lastMonthSaleMarginMap", lastMonthSaleMarginMap);
1273
		model.addAttribute("lastMonthSaleMarginMap", lastMonthSaleMarginMap);
1277
		model.addAttribute("lastMonthPendingIncomeMap", lastMonthPendingIncomeMap);
1274
		model.addAttribute("lastMonthPendingIncomeMap", lastMonthPendingIncomeMap);
1278
 
1275
 
1279
		model.addAttribute("totalAmountMap", totalAmountMap);
1276
		model.addAttribute("totalAmountMap", totalAmountMap);