Subversion Repositories SmartDukaan

Rev

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

Rev 31218 Rev 31249
Line 4429... Line 4429...
4429
		Map<Integer, Double> secondaryMtd = orderRepository
4429
		Map<Integer, Double> secondaryMtd = orderRepository
4430
				.selectBillingDatesBetweenSumGroupByRetailerId(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX));
4430
				.selectBillingDatesBetweenSumGroupByRetailerId(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX));
4431
		Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
4431
		Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
4432
				curDate.with(LocalTime.MAX), 0, false);
4432
				curDate.with(LocalTime.MAX), 0, false);
4433
 
4433
 
4434
		String subject = "";
4434
		String subject = "Monthly Target Vs Achievement";
4435
 
4435
 
4436
		for (Entry<Integer, MonthlyTarget> partnerMonthlyTargetEntry : partnersMonthlyTarget.entrySet()) {
4436
		for (Entry<Integer, MonthlyTarget> partnerMonthlyTargetEntry : partnersMonthlyTarget.entrySet()) {
4437
 
4437
 
4438
			int fofoId = partnerMonthlyTargetEntry.getKey();
4438
			int fofoId = partnerMonthlyTargetEntry.getKey();
4439
 
4439
 
Line 4444... Line 4444...
4444
			Double saleTarget = partnerMonthlyTargetEntry.getValue().getSaleTarget();
4444
			Double saleTarget = partnerMonthlyTargetEntry.getValue().getSaleTarget();
4445
 
4445
 
4446
			if (purchaseTarget > 0) {
4446
			if (purchaseTarget > 0) {
4447
				Double purchase = secondaryMtd.get(fofoId);
4447
				Double purchase = secondaryMtd.get(fofoId);
4448
 
4448
 
-
 
4449
				if (purchase == null) {
-
 
4450
					purchase = 0.0;
-
 
4451
				}
-
 
4452
 
-
 
4453
				Double balanceTarget = purchaseTarget - purchase;
-
 
4454
 
-
 
4455
				if (balanceTarget <= 0) {
-
 
4456
					balanceTarget = 0.0;
-
 
4457
				}
-
 
4458
 
4449
				StringBuilder sb = new StringBuilder();
4459
				StringBuilder sb = new StringBuilder();
4450
				sb.append("<html><body><p>Hi,");
4460
				sb.append("<html><body><p>Dear Partner,\n");
-
 
4461
				sb.append("<p>Pls note your agreed monthly target is Rs." + purchaseTarget
-
 
4462
						+ " and your achievement till date is Rs." + purchase + "</p>");
-
 
4463
				sb.append("<p>Pls note that your balance target is Rs." + balanceTarget + "</p>\n");
-
 
4464
				sb.append(
-
 
4465
						"<p>We wish you all the best and we are confident that this focussed approach towards our outlet sales will help us take our outlet to the best SmartDukaan in your city.\n"
-
 
4466
								+ "</p>\n");
4451
 
4467
 
4452
				this.sendMailOfHtmlFormat(customRetailer.getEmail(), sb.toString(), null, subject);
4468
				this.sendMailOfHtmlFormat(customRetailer.getEmail(), sb.toString(), null, subject);
4453
 
4469
 
-
 
4470
				// this.sendMailOfHtmlFormat("tejbeer.kaur@smartdukaan.com", sb.toString(),
-
 
4471
				// null, subject);
-
 
4472
 
4454
			}
4473
			}
4455
 
4474
 
4456
		}
4475
		}
4457
 
4476
 
4458
	}
4477
	}
Line 4478... Line 4497...
4478
		Map<Integer, Double> secondaryMtd = orderRepository
4497
		Map<Integer, Double> secondaryMtd = orderRepository
4479
				.selectBillingDatesBetweenSumGroupByRetailerId(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX));
4498
				.selectBillingDatesBetweenSumGroupByRetailerId(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX));
4480
		Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
4499
		Map<Integer, Double> todaytertiary = fofoOrderItemRepository.selectSumMopGroupByRetailer(curDate,
4481
				curDate.with(LocalTime.MAX), 0, false);
4500
				curDate.with(LocalTime.MAX), 0, false);
4482
 
4501
 
4483
		String subject = "";
4502
		String subject = "Monthly Target Vs Achievement";
4484
 
4503
 
4485
		for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
4504
		for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
4486
 
4505
 
4487
			String email = storeGuyEntry.getKey();
4506
			String email = storeGuyEntry.getKey();
4488
 
4507
 
4489
			List<Integer> fofoIds = new ArrayList<>(storeGuyEntry.getValue());
4508
			List<Integer> fofoIds = new ArrayList<>(storeGuyEntry.getValue());
4490
			Map<Integer, MonthlyTarget> monthlyTargetAchievement = new HashMap<>();
4509
			Map<Integer, MonthlyTarget> monthlyTargetAchievement = new HashMap<>();
4491
			for (Integer fofoId : fofoIds) {
4510
			for (Integer fofoId : fofoIds) {
4492
 
4511
 
4493
				MonthlyTarget monthlyTarget = partnersMonthlyTarget.get(fofoId);
4512
				MonthlyTarget monthlyTarget = partnersMonthlyTarget.get(fofoId);
-
 
4513
				if (monthlyTarget != null) {
4494
				Double purchaseTarget = monthlyTarget.getPurchaseTarget();
4514
					Double purchaseTarget = monthlyTarget.getPurchaseTarget();
4495
 
4515
 
4496
				Double saleTarget = monthlyTarget.getSaleTarget();
4516
					Double saleTarget = monthlyTarget.getSaleTarget();
4497
 
4517
 
4498
				if (purchaseTarget > 0) {
4518
					if (purchaseTarget != null && purchaseTarget > 0) {
4499
					Double purchase = secondaryMtd.get(fofoId);
4519
						Double purchase = secondaryMtd.get(fofoId);
-
 
4520
						if (purchase == null) {
-
 
4521
							purchase = 0.0;
-
 
4522
						}
4500
					monthlyTarget.setPurchaseAchievement(purchase);
4523
						monthlyTarget.setPurchaseAchievement(purchase);
4501
					monthlyTargetAchievement.put(fofoId, monthlyTarget);
4524
						monthlyTargetAchievement.put(fofoId, monthlyTarget);
4502
 
4525
 
-
 
4526
					}
4503
				}
4527
				}
4504
			}
4528
			}
4505
 
4529
 
4506
			if (!monthlyTargetAchievement.isEmpty()) {
4530
			if (!monthlyTargetAchievement.isEmpty()) {
4507
 
4531
 
4508
				StringBuilder sb = new StringBuilder();
4532
				StringBuilder sb = new StringBuilder();
4509
 
4533
 
-
 
4534
				sb.append("<html><body><p>Hi,\n");
-
 
4535
				sb.append("<p>Pls note your Partners agreed monthly target foolowing are :</p>\n"
4510
				sb.append("<html><body><p>Hi,\n" + "<table style='border:1px solid black ;padding: 5px';>");
4536
						+ " <table style='border:1px solid black ;padding: 5px';>");
4511
				sb.append("<tbody>\n" + "	" + "    				" + "<tr>\n");
4537
				sb.append("<tbody>\n" + "	" + "    				" + "<tr>\n");
4512
				sb.append("<th style='border:1px solid black;padding: 5px'>Partner Name</th>\n");
4538
				sb.append("<th style='border:1px solid black;padding: 5px'>Partner Name</th>\n");
4513
 
4539
 
4514
				sb.append("<th style='border:1px solid black;padding: 5px'>Purchase Target</th>\n");
4540
				sb.append("<th style='border:1px solid black;padding: 5px'>Purchase Target</th>\n");
4515
 
4541
 
Line 4534... Line 4560...
4534
					sb.append("</tr>\n");
4560
					sb.append("</tr>\n");
4535
 
4561
 
4536
				}
4562
				}
4537
 
4563
 
4538
				this.sendMailOfHtmlFormat(email, sb.toString(), null, subject);
4564
				this.sendMailOfHtmlFormat(email, sb.toString(), null, subject);
-
 
4565
				// this.sendMailOfHtmlFormat("tejbeer.kaur@smartdukaan.com", sb.toString(),
-
 
4566
				// null, subject);
4539
 
4567
 
4540
			}
4568
			}
4541
 
4569
 
4542
		}
4570
		}
4543
 
4571