Subversion Repositories SmartDukaan

Rev

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

Rev 33212 Rev 33220
Line 694... Line 694...
694
            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
694
            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
695
        }
695
        }
696
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
696
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
697
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
697
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
698
        UserWallet uw = walletService.getUserWallet(fofoId);
698
        UserWallet uw = walletService.getUserWallet(fofoId);
-
 
699
        LOGGER.info("Start date - {}, end Date - {}", startDate, endDate);
699
        List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);
700
        List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);
-
 
701
        //LOGGER.info("Data - {}", history.stream().filter(x -> x.getReferenceType().equals(WalletReferenceType.OTHERS)).collect(Collectors.groupingBy(x -> x.getBusinessTimestamp().toLocalDate())));
700
        history = history.stream().filter(x -> !x.getReferenceType().equals(WalletReferenceType.PURCHASE))
702
        history = history.stream().filter(x -> !x.getReferenceType().equals(WalletReferenceType.PURCHASE))
701
                .filter(x -> !WalletService.CN_WALLET_REFERENCES.contains(x.getReferenceType())).sorted(Comparator.comparing(UserWalletHistory::getId)).collect(Collectors.toList());
703
                .filter(x -> !WalletService.CN_WALLET_REFERENCES.contains(x.getReferenceType())).sorted(Comparator.comparing(UserWalletHistory::getId)).collect(Collectors.toList());
-
 
704
        //LOGGER.info("Data - {}", history.stream().filter(x -> x.getReferenceType().equals(WalletReferenceType.OTHERS)).collect(Collectors.groupingBy(x -> x.getBusinessTimestamp().toLocalDate())));
702
 
705
 
703
        InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
706
        InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
704
        CustomRetailer customRetailer = retailerService.getAllFofoRetailers().get(fofoId);
707
        CustomRetailer customRetailer = retailerService.getAllFofoRetailers().get(fofoId);
705
        List<StatementDetailModel> details = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
708
        List<StatementDetailModel> details = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
706
        Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate, Optional.of(fofoId));
709
        Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate, Optional.of(fofoId));
Line 730... Line 733...
730
    CreditNoteLineRepository creditNoteLineRepository;
733
    CreditNoteLineRepository creditNoteLineRepository;
731
 
734
 
732
    private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance, CustomRetailer customRetailer, List<UserWalletHistory> history,
735
    private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance, CustomRetailer customRetailer, List<UserWalletHistory> history,
733
                                               LocalDateTime startLocalDateTime, LocalDateTime endLocalDateTime, List<StatementDetailModel> invoiceDetails) throws Exception {
736
                                               LocalDateTime startLocalDateTime, LocalDateTime endLocalDateTime, List<StatementDetailModel> invoiceDetails) throws Exception {
734
        Map<LocalDate, List<StatementDetailModel>> dateInvoiceMap = invoiceDetails.stream().collect(Collectors.groupingBy(x -> x.getOnDate().toLocalDate()));
737
        Map<LocalDate, List<StatementDetailModel>> dateInvoiceMap = invoiceDetails.stream().collect(Collectors.groupingBy(x -> x.getOnDate().toLocalDate()));
735
        LOGGER.info("dateInvoiceMap - {}", dateInvoiceMap);
738
        //LOGGER.info("dateInvoiceMap - {}", dateInvoiceMap);
736
        Map<LocalDate, List<UserWalletHistory>> dateWalletMap = history.stream().collect(Collectors.groupingBy(x -> x.getBusinessTimestamp().toLocalDate()));
739
        Map<LocalDate, List<UserWalletHistory>> dateWalletMap = history.stream().collect(Collectors.groupingBy(x -> x.getTimestamp().toLocalDate()));
737
        XSSFWorkbook workbook = new XSSFWorkbook(is);
740
        XSSFWorkbook workbook = new XSSFWorkbook(is);
738
        CreationHelper creationHelper = workbook.getCreationHelper();
741
        CreationHelper creationHelper = workbook.getCreationHelper();
739
        CellStyle style2 = workbook.createCellStyle();
742
        CellStyle style2 = workbook.createCellStyle();
740
        style2.setDataFormat(creationHelper.createDataFormat().getFormat("dd/mm/yyyy"));
743
        style2.setDataFormat(creationHelper.createDataFormat().getFormat("dd/mm/yyyy"));
741
 
744
 
Line 748... Line 751...
748
        long grandTotalDebit = 0l;
751
        long grandTotalDebit = 0l;
749
        long grandTotalCredit = 0l;
752
        long grandTotalCredit = 0l;
750
        int row = 4;
753
        int row = 4;
751
        LocalDate startDate = startLocalDateTime.toLocalDate();
754
        LocalDate startDate = startLocalDateTime.toLocalDate();
752
        LocalDate endDate = endLocalDateTime.toLocalDate();
755
        LocalDate endDate = endLocalDateTime.toLocalDate();
-
 
756
        LOGGER.info(" startDate - {}", startDate);
-
 
757
        LOGGER.info(" endDate - {}", endDate);
753
        for (LocalDate date = startDate; date.isBefore(endDate.plusDays(1)); date = date.plusDays(1)) {
758
        for (LocalDate date = startDate; date.isBefore(endDate.plusDays(1)); date = date.plusDays(1)) {
754
            List<UserWalletHistory> datewiseWalletHistory = dateWalletMap.get(date);
759
            List<UserWalletHistory> datewiseWalletHistory = dateWalletMap.get(date);
-
 
760
            LOGGER.info("date - {}, datewiseWalletHistory - {}", date, datewiseWalletHistory);
755
            if (datewiseWalletHistory != null) {
761
            if (datewiseWalletHistory != null) {
756
                for (UserWalletHistory walletEntry : datewiseWalletHistory) {
762
                for (UserWalletHistory walletEntry : datewiseWalletHistory) {
757
                    Cell dateCell = sheet.createRow(row).createCell(0);
763
                    Cell dateCell = sheet.createRow(row).createCell(0);
758
                    dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
764
                    dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
759
                    dateCell.setCellStyle(style2);
765
                    dateCell.setCellStyle(style2);