| Line 391... |
Line 391... |
| 391 |
|
391 |
|
| 392 |
LOGGER.info("walletSummartList {}", fofoId);
|
392 |
LOGGER.info("walletSummartList {}", fofoId);
|
| 393 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
|
393 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
|
| 394 |
String partnerDetail = null;
|
394 |
String partnerDetail = null;
|
| 395 |
// Headers for the table data
|
395 |
// Headers for the table data
|
| 396 |
rows.add(Arrays.asList("Id", "Amount", "Refundable_amount", "Reference", "Reference_type", "Running Balance", "Business_timestamp", "Description"));
|
396 |
rows.add(Arrays.asList("Id", "Amount", "Refundable_amount", "Reference", "Reference_type", "Running Balance", "Business_timestamp", "timestamp", "Description"));
|
| 397 |
for (WalletSummaryReportModel walletSummary : walletSummartList) {
|
397 |
for (WalletSummaryReportModel walletSummary : walletSummartList) {
|
| 398 |
partnerDetail = walletSummary.getName() + "(" + walletSummary.getCode() + "-" + walletSummary.getPhone() + ")" + "-" + walletSummary.getEmail();
|
398 |
partnerDetail = walletSummary.getName() + "(" + walletSummary.getCode() + "-" + walletSummary.getPhone() + ")" + "-" + walletSummary.getEmail();
|
| 399 |
|
399 |
|
| 400 |
rows.add(Arrays.asList(
|
400 |
rows.add(Arrays.asList(
|
| 401 |
walletSummary.getId(),
|
401 |
walletSummary.getId(),
|
| Line 403... |
Line 403... |
| 403 |
walletSummary.getRefundableAmount(),
|
403 |
walletSummary.getRefundableAmount(),
|
| 404 |
walletSummary.getReference(),
|
404 |
walletSummary.getReference(),
|
| 405 |
walletSummary.getReferenceType(),
|
405 |
walletSummary.getReferenceType(),
|
| 406 |
openingBalance + walletSummary.getAmount(),
|
406 |
openingBalance + walletSummary.getAmount(),
|
| 407 |
FormattingUtils.format(walletSummary.getBusinessTimestamp() != null ? walletSummary.getBusinessTimestamp() : walletSummary.getTimestamp()),
|
407 |
FormattingUtils.format(walletSummary.getBusinessTimestamp() != null ? walletSummary.getBusinessTimestamp() : walletSummary.getTimestamp()),
|
| - |
|
408 |
walletSummary.getTimestamp(),
|
| 408 |
walletSummary.getDescription()
|
409 |
walletSummary.getDescription()
|
| 409 |
));
|
410 |
));
|
| 410 |
|
411 |
|
| 411 |
}
|
412 |
}
|
| 412 |
|
413 |
|
| Line 428... |
Line 429... |
| 428 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
429 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 429 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
430 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 430 |
if (startDate == null) {
|
431 |
if (startDate == null) {
|
| 431 |
startDate = LocalDate.now().minusDays(30);
|
432 |
startDate = LocalDate.now().minusDays(30);
|
| 432 |
}
|
433 |
}
|
| - |
|
434 |
if (endDate == null) {
|
| 433 |
endDate = LocalDate.now();
|
435 |
endDate = LocalDate.now();
|
| - |
|
436 |
}
|
| 434 |
model.addAttribute("startDate", startDate);
|
437 |
List<WalletSummaryReportModel> walletSummartList = new ArrayList<>();
|
| 435 |
model.addAttribute("endDate", endDate);
|
438 |
float openingBalance = 0;
|
| 436 |
model.addAttribute("isAdmin", isAdmin);
|
439 |
float openingPendingAmount = 0;
|
| 437 |
if (isAdmin) {
|
440 |
if (isAdmin) {
|
| 438 |
if (fofoId == 0) {
|
441 |
if (fofoId > 0) {
|
| 439 |
//No need to send any data
|
- |
|
| 440 |
model.addAttribute("walletSummartList", new ArrayList<>());
|
- |
|
| 441 |
|
- |
|
| 442 |
return "wallet-summary-report";
|
- |
|
| 443 |
} else {
|
- |
|
| 444 |
float openingBalance = walletService.getOpeningTill(fofoId, startDate.atStartOfDay());
|
442 |
openingBalance = walletService.getOpeningTill(fofoId, startDate.atStartOfDay());
|
| 445 |
Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate.atStartOfDay(), Optional.of(fofoId));
|
443 |
Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate.atStartOfDay(), Optional.of(fofoId));
|
| 446 |
float openingPendingAmount = openingAmountMap.get(fofoId) == null ? 0 : openingAmountMap.get(fofoId);
|
444 |
openingPendingAmount = openingAmountMap.get(fofoId) == null ? 0 : openingAmountMap.get(fofoId);
|
| 447 |
|
- |
|
| 448 |
List<WalletSummaryReportModel> walletSummartList = fofoOrderRepository
|
- |
|
| 449 |
.selectWalletSummaryReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
445 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
| 450 |
model.addAttribute("walletSummartList", walletSummartList);
|
446 |
LOGGER.info("startDate - " + startDate.atStartOfDay());
|
| 451 |
model.addAttribute("openingBalance", (openingBalance + openingPendingAmount));
|
447 |
LOGGER.info("endDate - " + endDate.atTime(LocalTime.MAX));
|
| 452 |
|
- |
|
| 453 |
return "wallet-summary-report";
|
- |
|
| 454 |
}
|
448 |
}
|
| 455 |
|
- |
|
| 456 |
} else {
|
449 |
} else {
|
| 457 |
|
- |
|
| 458 |
|
- |
|
| 459 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
- |
|
| 460 |
List<WalletSummaryReportModel> walletSummartList = fofoOrderRepository
|
- |
|
| 461 |
.selectWalletSummaryReport(loginDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
450 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(loginDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
| 462 |
//LOGGER.info("walletSummartList {}", walletSummartList);
|
- |
|
| 463 |
|
- |
|
| 464 |
model.addAttribute("walletSummartList", walletSummartList);
|
- |
|
| 465 |
|
- |
|
| 466 |
return "wallet-summary-report";
|
- |
|
| 467 |
}
|
451 |
}
|
| - |
|
452 |
LOGGER.info("walletSummartList {}", walletSummartList);
|
| - |
|
453 |
model.addAttribute("walletSummartList", walletSummartList);
|
| - |
|
454 |
model.addAttribute("openingBalance", (openingBalance + openingPendingAmount));
|
| - |
|
455 |
model.addAttribute("startDate", startDate);
|
| - |
|
456 |
model.addAttribute("endDate", endDate);
|
| - |
|
457 |
model.addAttribute("isAdmin", isAdmin);
|
| - |
|
458 |
return "wallet-summary-report";
|
| 468 |
}
|
459 |
}
|
| 469 |
|
460 |
|
| 470 |
@RequestMapping(value = "/walletSummaryReport", method = RequestMethod.GET)
|
461 |
@RequestMapping(value = "/walletSummaryReport", method = RequestMethod.GET)
|
| 471 |
public String getWalletSummaryReport(HttpServletRequest request, Model model) throws Exception {
|
462 |
public String getWalletSummaryReport(HttpServletRequest request, Model model) throws Exception {
|
| 472 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
463 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 473 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
464 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
| 474 |
LocalDateTime currentDate = LocalDate.now().atStartOfDay();
|
465 |
LocalDateTime startDate = LocalDateTime.now().minusDays(30);
|
| 475 |
LocalDateTime currentStartMonth = currentDate.minusDays(30).toLocalDate().atStartOfDay();
|
466 |
LocalDateTime endDate = LocalDateTime.now();
|
| 476 |
|
- |
|
| 477 |
List<WalletSummaryReportModel> walletSummartList = fofoOrderRepository
|
467 |
List<WalletSummaryReportModel> walletSummartList = new ArrayList<>();
|
| - |
|
468 |
if (!isAdmin) {
|
| - |
|
469 |
walletSummartList = fofoOrderRepository
|
| 478 |
.selectWalletSummaryReport(fofoDetails.getFofoId(), currentStartMonth, currentDate);
|
470 |
.selectWalletSummaryReport(fofoDetails.getFofoId(), startDate, endDate);
|
| - |
|
471 |
}
|
| 479 |
LOGGER.info("walletSummartList {}", walletSummartList);
|
472 |
LOGGER.info("walletSummartList {}", walletSummartList);
|
| 480 |
|
- |
|
| 481 |
model.addAttribute("startDate", currentDate.minusDays(30).toLocalDate());
|
473 |
model.addAttribute("startDate", startDate.toLocalDate());
|
| 482 |
model.addAttribute("endDate", LocalDate.now());
|
474 |
model.addAttribute("endDate", endDate.toLocalDate());
|
| 483 |
model.addAttribute("walletSummartList", walletSummartList);
|
475 |
model.addAttribute("walletSummartList", walletSummartList);
|
| 484 |
model.addAttribute("isAdmin", isAdmin);
|
476 |
model.addAttribute("isAdmin", isAdmin);
|
| 485 |
|
477 |
|
| 486 |
return "wallet-summary-report";
|
478 |
return "wallet-summary-report";
|
| 487 |
}
|
479 |
}
|