Subversion Repositories SmartDukaan

Rev

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

Rev 24312 Rev 24315
Line 23... Line 23...
23
import org.springframework.web.bind.annotation.RequestMethod;
23
import org.springframework.web.bind.annotation.RequestMethod;
24
import org.springframework.web.bind.annotation.RequestParam;
24
import org.springframework.web.bind.annotation.RequestParam;
25
 
25
 
26
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
26
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
27
import com.spice.profitmandi.common.model.ProfitMandiConstants;
27
import com.spice.profitmandi.common.model.ProfitMandiConstants;
28
import com.spice.profitmandi.common.util.FormattingUtils;
-
 
29
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
28
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
30
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
29
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
31
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
30
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
32
import com.spice.profitmandi.dao.entity.transaction.Order;
31
import com.spice.profitmandi.dao.entity.transaction.Order;
33
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
32
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
Line 44... Line 43...
44
import com.spice.profitmandi.web.model.LoginDetails;
43
import com.spice.profitmandi.web.model.LoginDetails;
45
import com.spice.profitmandi.web.util.CookiesProcessor;
44
import com.spice.profitmandi.web.util.CookiesProcessor;
46
import com.spice.profitmandi.web.util.MVCResponseSender;
45
import com.spice.profitmandi.web.util.MVCResponseSender;
47
 
46
 
48
import be.ceau.chart.BarChart;
47
import be.ceau.chart.BarChart;
-
 
48
import be.ceau.chart.color.Color;
49
import be.ceau.chart.data.BarData;
49
import be.ceau.chart.data.BarData;
50
import be.ceau.chart.dataset.BarDataset;
50
import be.ceau.chart.dataset.BarDataset;
51
import be.ceau.chart.options.BarOptions;
51
import be.ceau.chart.options.BarOptions;
52
import be.ceau.chart.options.Title;
52
import be.ceau.chart.options.Title;
53
import be.ceau.chart.options.scales.BarScale;
53
import be.ceau.chart.options.scales.BarScale;
Line 282... Line 282...
282
		List<List<Integer>> billingPendingStackList = new ArrayList<>();
282
		List<List<Integer>> billingPendingStackList = new ArrayList<>();
283
		List<List<Integer>> inTransitStackList = new ArrayList<>();
283
		List<List<Integer>> inTransitStackList = new ArrayList<>();
284
		List<List<LocalDate>> datesList = new ArrayList<>();
284
		List<List<LocalDate>> datesList = new ArrayList<>();
285
 
285
 
286
		int currentWeekOfYear = 0;
286
		int currentWeekOfYear = 0;
-
 
287
		List<Integer> walletStack = null;
-
 
288
		List<Integer> inStockStack = null;
-
 
289
		List<Integer> salesStack = null;
-
 
290
		List<Integer> grnPendingStack = null;
-
 
291
		List<Integer> billingPendingStack = null;
-
 
292
		List<Integer> inTransitStack = null;
-
 
293
		List<LocalDate> dates = null;
287
		for (PartnerDailyInvestment pdi : partnerInvestments) {
294
		for (PartnerDailyInvestment pdi : partnerInvestments) {
288
			List<Integer> walletStack = null;
-
 
289
			List<Integer> inStockStack = null;
-
 
290
			List<Integer> salesStack = null;
-
 
291
			List<Integer> grnPendingStack = null;
-
 
292
			List<Integer> billingPendingStack = null;
-
 
293
			List<Integer> inTransitStack = null;
-
 
294
			List<LocalDate> dates = null;
-
 
295
			int weekOfYear = pdi.getDate().get(WeekFields.ISO.weekOfYear());
295
			int weekOfYear = pdi.getDate().get(WeekFields.ISO.weekOfYear());
296
			if (weekOfYear != currentWeekOfYear) {
296
			if (weekOfYear != currentWeekOfYear) {
297
				walletStack = new ArrayList<>();
297
				walletStack = new ArrayList<>();
298
				inStockStack = new ArrayList<>();
298
				inStockStack = new ArrayList<>();
299
				salesStack = new ArrayList<>();
299
				salesStack = new ArrayList<>();
Line 321... Line 321...
321
		
321
		
322
		int counter = 0;
322
		int counter = 0;
323
		BarData barData = new BarData();
323
		BarData barData = new BarData();
324
		while(counter < walletStackList.size()) {
324
		while(counter < walletStackList.size()) {
325
			barData
325
			barData
326
			.addDataset(new BarDataset().setData(walletStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Wallet"))
326
			.addDataset(new BarDataset().setData(walletStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Wallet").addBackgroundColor(Color.BLUE))
327
			.addDataset(new BarDataset().setData(inStockStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Stock"))
327
			.addDataset(new BarDataset().setData(inStockStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Stock").addBackgroundColor(Color.LIGHT_BLUE))
328
			.addDataset(new BarDataset().setData(salesStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Sales"))
328
			.addDataset(new BarDataset().setData(salesStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Sales").addBackgroundColor(Color.YELLOW))
329
			.addDataset(new BarDataset().setData(grnPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Grn Pending"))
329
			.addDataset(new BarDataset().setData(grnPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Grn Pending").addBackgroundColor(Color.LIGHT_YELLOW))
330
			.addDataset(new BarDataset().setData(billingPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Billing Pending"))
330
			.addDataset(new BarDataset().setData(billingPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Billing Pending").addBackgroundColor(Color.GREEN))
331
			.addDataset(new BarDataset().setData(inTransitStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Transit"));
331
			.addDataset(new BarDataset().setData(inTransitStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Transit").addBackgroundColor(Color.GREEN_YELLOW));
332
			counter++;
332
			counter++;
333
		}
333
		}
334
		BarOptions barOptions = new BarOptions()
334
		BarOptions barOptions = new BarOptions()
335
				.setTitle(new Title().setText("Daily Investment Summary"))
335
				.setTitle(new Title().setDisplay(true).setText("Daily Investment Summary"))
-
 
336
				.setResponsive(true)
-
 
337
				
336
				.setScales(new BarScale().addxAxes(new XAxis<LinearTicks>().setStacked(true))
338
				.setScales(new BarScale().addxAxes(new XAxis<LinearTicks>().setStacked(true))
337
										 .addyAxes(new YAxis<LinearTicks>().setStacked(true))
339
										 .addyAxes(new YAxis<LinearTicks>().setStacked(true))
338
										 );
340
										 );
339
						
341
						
340
		BarChart barChart = new BarChart(barData, barOptions);
342
		BarChart barChart = new BarChart(barData, barOptions);