Subversion Repositories SmartDukaan

Rev

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

Rev 24119 Rev 24131
Line 37... Line 37...
37
import com.spice.profitmandi.common.model.PartnerTargetModel;
37
import com.spice.profitmandi.common.model.PartnerTargetModel;
38
import com.spice.profitmandi.common.model.ProfitMandiConstants;
38
import com.spice.profitmandi.common.model.ProfitMandiConstants;
39
import com.spice.profitmandi.common.model.SchemeModel;
39
import com.spice.profitmandi.common.model.SchemeModel;
40
import com.spice.profitmandi.common.model.TagListingModel;
40
import com.spice.profitmandi.common.model.TagListingModel;
41
 
41
 
42
import in.shop2020.model.v1.catalog.SalesPotential;
-
 
43
 
-
 
44
public class ExcelUtils {
42
public class ExcelUtils {
45
	private static final String TAG_ID = "Tag Id";
43
	private static final String TAG_ID = "Tag Id";
46
	private static final String TAG_LABEL = "Tag Label";
44
	private static final String TAG_LABEL = "Tag Label";
47
	private static final String ITEM_ID = "Item Id";
45
	private static final String ITEM_ID = "Item Id";
48
	private static final String BRAND = "Brand";
46
	private static final String BRAND = "Brand";
Line 750... Line 748...
750
 
748
 
751
	public static void writeDailySaleReportVsTarget(Map<Integer, Float> targetValues, Map<Integer, Double> saleValues,
749
	public static void writeDailySaleReportVsTarget(Map<Integer, Float> targetValues, Map<Integer, Double> saleValues,
752
			Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer, Map<Integer, String> fofoIdsAndSlabNames,
750
			Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer, Map<Integer, String> fofoIdsAndSlabNames,
753
			Map<Integer, Double> monthlyTargetAchievementPercentage, Map<Integer, Float> dailyAverageSale,
751
			Map<Integer, Double> monthlyTargetAchievementPercentage, Map<Integer, Float> dailyAverageSale,
754
			Map<Integer, Double> remainingMonthlyTargets, Map<Integer, Double> todayAchievements,
752
			Map<Integer, Double> remainingMonthlyTargets, Map<Integer, Double> todayAchievements,
755
			Map<Integer, Float> todayAchievementsPercentage, OutputStream outputStream) {
753
			Map<Integer, Float> todayAchievementsPercentage, List<Integer> fofoIds,
-
 
754
			Map<Integer, String> salesHeadNameAndFofoIdMap, OutputStream outputStream) {
756
		SXSSFWorkbook workbook = new SXSSFWorkbook();
755
		SXSSFWorkbook workbook = new SXSSFWorkbook();
757
 
756
 
758
		// CreationHelper createHelper = workbook.getCreationHelper();
757
		// CreationHelper createHelper = workbook.getCreationHelper();
759
 
758
 
760
		SXSSFSheet sheet = workbook.createSheet("DailySaleReports");
759
		SXSSFSheet sheet = workbook.createSheet("DailySaleReports");
761
		sheet.trackAllColumnsForAutoSizing();
760
		sheet.trackAllColumnsForAutoSizing();
762
 
761
 
763
		Row rowHeader = sheet.createRow(0);
762
		Row rowHeader = sheet.createRow(0);
-
 
763
		Cell cellsaleHead = rowHeader.createCell(0);
-
 
764
		cellsaleHead.setCellValue("SalesHead");
764
		Cell cellFOfoId = rowHeader.createCell(0);
765
		Cell cellFOfoId = rowHeader.createCell(1);
765
		cellFOfoId.setCellValue("FoFoId");
766
		cellFOfoId.setCellValue("FoFoId");
766
		Cell cellStoreName = rowHeader.createCell(1);
767
		Cell cellStoreName = rowHeader.createCell(2);
767
		cellStoreName.setCellValue("Store Name");
768
		cellStoreName.setCellValue("Store Name");
768
		Cell cellTargetValue = rowHeader.createCell(2);
769
		Cell cellTargetValue = rowHeader.createCell(3);
769
		cellTargetValue.setCellValue("MTD Target Value");
770
		cellTargetValue.setCellValue("MTD Target Value");
770
		Cell cellDailyTarget = rowHeader.createCell(3);
771
		Cell cellDailyTarget = rowHeader.createCell(4);
771
		cellDailyTarget.setCellValue("Daily Target");
772
		cellDailyTarget.setCellValue("Daily Target");
772
		Cell cellTodayAchievement = rowHeader.createCell(4);
773
		Cell cellTodayAchievement = rowHeader.createCell(5);
773
		cellTodayAchievement.setCellValue("Today Achievement");
774
		cellTodayAchievement.setCellValue("Today Achievement");
774
		Cell cellTodayAchievementPercentage = rowHeader.createCell(5);
775
		Cell cellTodayAchievementPercentage = rowHeader.createCell(6);
775
		cellTodayAchievementPercentage.setCellValue("Today Achievement %");
776
		cellTodayAchievementPercentage.setCellValue("Today Achievement %");
776
		Cell cellMonthlySaleValue = rowHeader.createCell(6);
777
		Cell cellMonthlySaleValue = rowHeader.createCell(7);
777
		cellMonthlySaleValue.setCellValue("MTD Achievement");
778
		cellMonthlySaleValue.setCellValue("MTD Achievement");
778
		Cell cellMonthlySaleValuePercentage = rowHeader.createCell(7);
779
		Cell cellMonthlySaleValuePercentage = rowHeader.createCell(8);
779
		cellMonthlySaleValuePercentage.setCellValue("MTD Achievement%");
780
		cellMonthlySaleValuePercentage.setCellValue("MTD Achievement%");
780
		Cell cellRemainingTarget = rowHeader.createCell(8);
781
		Cell cellRemainingTarget = rowHeader.createCell(9);
781
		cellRemainingTarget.setCellValue("Remaining");
782
		cellRemainingTarget.setCellValue("Remaining");
782
		Cell cellEligibility = rowHeader.createCell(9);
783
		Cell cellEligibility = rowHeader.createCell(10);
783
		cellEligibility.setCellValue("Eligibility");
784
		cellEligibility.setCellValue("Eligibility");
784
		Font font = workbook.createFont();
785
		Font font = workbook.createFont();
785
		CellStyle cellStyle = workbook.createCellStyle();
786
		CellStyle cellStyle = workbook.createCellStyle();
786
		font.setBold(true);
787
		font.setBold(true);
787
		cellStyle.setAlignment(HorizontalAlignment.CENTER);
788
		cellStyle.setAlignment(HorizontalAlignment.CENTER);
Line 791... Line 792...
791
			if (rowHeader.getCell(i) != null) {
792
			if (rowHeader.getCell(i) != null) {
792
				rowHeader.getCell(i).setCellStyle(cellStyle);
793
				rowHeader.getCell(i).setCellStyle(cellStyle);
793
			}
794
			}
794
		}
795
		}
795
		int rownum = 1;
796
		int rownum = 1;
796
		for (Integer fofoId : saleValues.keySet()) {
797
		for (Integer fofoId : fofoIds) {
797
			Row row = sheet.createRow(rownum++);
798
			Row row = sheet.createRow(rownum++);
798
			int cellnum = 0;
799
			int cellnum = 0;
-
 
800
			Cell cellSaleName = row.createCell(cellnum++);
-
 
801
			if (salesHeadNameAndFofoIdMap.get(fofoId) != null) {
-
 
802
 
-
 
803
				cellSaleName.setCellValue(salesHeadNameAndFofoIdMap.get(fofoId));
-
 
804
			} else {
-
 
805
				cellSaleName.setCellValue("No SalesHead");
-
 
806
			}
799
			Cell cellFofoId = row.createCell(cellnum++);
807
			Cell cellFofoId = row.createCell(cellnum++);
800
			cellFofoId.setCellValue(fofoId);
808
			cellFofoId.setCellValue(fofoId);
801
			Cell cellPartner = row.createCell(cellnum++);
809
			Cell cellPartner = row.createCell(cellnum++);
802
			if (fofoIdsAndCustomRetailer.get(fofoId)!= null) {
810
			if (fofoIdsAndCustomRetailer.get(fofoId) != null) {
803
				cellPartner.setCellValue(fofoIdsAndCustomRetailer.get(fofoId).getBusinessName());
811
				cellPartner.setCellValue(fofoIdsAndCustomRetailer.get(fofoId).getBusinessName());
804
			} else {
812
			} else {
805
				cellPartner.setCellValue("Name Not Associated");
813
				cellPartner.setCellValue("Name Not Associated");
806
			}
814
			}
807
 
815
 
Line 812... Line 820...
812
				cellMTDTargetValue.setCellValue("Target not defined");
820
				cellMTDTargetValue.setCellValue("Target not defined");
813
			}
821
			}
814
 
822
 
815
			Cell cellDailyTargetValue = row.createCell(cellnum++);
823
			Cell cellDailyTargetValue = row.createCell(cellnum++);
816
			if (dailyAverageSale.get(fofoId) != null) {
824
			if (dailyAverageSale.get(fofoId) != null) {
817
				String formatting=FormattingUtils.formatDecimalTwoDigits(dailyAverageSale.get(fofoId));
825
				String formatting = FormattingUtils.formatDecimalTwoDigits(dailyAverageSale.get(fofoId));
818
				cellDailyTargetValue.setCellValue(formatting);
826
				cellDailyTargetValue.setCellValue(formatting);
819
			} else {
827
			} else {
820
				cellDailyTargetValue.setCellValue(0);
828
				cellDailyTargetValue.setCellValue(0);
821
			}
829
			}
822
			Cell cellTodayAchieveMentSaleValue = row.createCell(cellnum++);
830
			Cell cellTodayAchieveMentSaleValue = row.createCell(cellnum++);