Subversion Repositories SmartDukaan

Rev

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

Rev 34617 Rev 34781
Line 297... Line 297...
297
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
297
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
298
        int fofoId = loginDetails.getFofoId();
298
        int fofoId = loginDetails.getFofoId();
299
        Map<Integer, MonthSaleModel> monthSaleMap = new HashMap<>();
299
        Map<Integer, MonthSaleModel> monthSaleMap = new HashMap<>();
300
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
300
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
301
        int dayOfMonth = curDate.getDayOfMonth();
301
        int dayOfMonth = curDate.getDayOfMonth();
-
 
302
        YearMonth yearMonth = YearMonth.now();
302
        for (int i = 1; i <= 6; i++) {
303
        for (int i = 1; i <= 6; i++) {
303
            LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
304
            LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
304
            int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
305
            int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
305
            LOGGER.info("Start of previous Month {}, start of next month Month {}", startOfMonth, startOfMonth.plusMonths(1));
306
            LOGGER.info("Start of previous Month {}, start of next month Month {}", startOfMonth, startOfMonth.plusMonths(1));
306
            double monthSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusMonths(1), loginDetails.getFofoId(), false).get(fofoId);
307
            double monthSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusMonths(1), loginDetails.getFofoId(), false).get(fofoId);
307
 
308
 
308
            double mtdSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusDays(Math.min(dayOfMonth, lengthOfMonth)), loginDetails.getFofoId(), false).get(fofoId);
309
            double mtdSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusDays(Math.min(dayOfMonth, lengthOfMonth)), loginDetails.getFofoId(), false).get(fofoId);
309
 
310
 
310
            PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfMonth.toLocalDate());
311
            PartnerType partnerType = partnerTypeChangeService.getTypeOnMonth(fofoId, yearMonth.minusMonths(i));
311
 
312
 
312
            MonthSaleModel ms = new MonthSaleModel();
313
            MonthSaleModel ms = new MonthSaleModel();
313
            ms.setMtdSales(fofoUser.format((long) mtdSales));
314
            ms.setMtdSales(fofoUser.format((long) mtdSales));
314
            ms.setMonthlySales(fofoUser.format(((long) monthSales)));
315
            ms.setMonthlySales(fofoUser.format(((long) monthSales)));
315
            ms.setPartnerType(partnerType);
316
            ms.setPartnerType(partnerType);