Subversion Repositories SmartDukaan

Rev

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

Rev 10128 Rev 10129
Line 94... Line 94...
94
                    "Sales History(All-Sources)", "Avg Sales(All-Sources)", "Sales History(Website)", 
94
                    "Sales History(All-Sources)", "Avg Sales(All-Sources)", "Sales History(Website)", 
95
                    "Avg Sales(Website)", "Sales History(Ebay)", "Avg Sales(Ebay)", "Sales History(Snapdeal)", 
95
                    "Avg Sales(Website)", "Sales History(Ebay)", "Avg Sales(Ebay)", "Sales History(Snapdeal)", 
96
                    "Avg Sales(Snapdeal)", "Sales History(Flipkart)", "Avg Sales(Flipkart)",  
96
                    "Avg Sales(Snapdeal)", "Sales History(Flipkart)", "Avg Sales(Flipkart)",  
97
                    "Sales History(Amazon-MFN)", "Avg Sales(Amazon-MFN)"}, '\t'));
97
                    "Sales History(Amazon-MFN)", "Avg Sales(Amazon-MFN)"}, '\t'));
98
            
98
            
99
            Long stockCount = 0L;
99
            Long stockCount;
100
            Double stockValue = 0.0;
100
            Double stockValue;
101
            for (Item item : itemList) {
101
            for (Item item : itemList) {
102
            	stockCount = 0L;
102
            	stockCount = 0L;
103
            	stockValue = 0.0;
103
            	stockValue = 0.0;
104
            	Long totalOrderCount    = 0L;
104
            	Long totalOrderCount    = 0L;
105
            	Long websiteOrderCount  = 0L;
105
            	Long websiteOrderCount  = 0L;
Line 121... Line 121...
121
            	StringBuilder amzn_mfnSaleHistory = new StringBuilder("");
121
            	StringBuilder amzn_mfnSaleHistory = new StringBuilder("");
122
            	
122
            	
123
            	ItemInventory itemInventory = inventoryMap.get(item.getId());
123
            	ItemInventory itemInventory = inventoryMap.get(item.getId());
124
            	Map<Long, Long> availabilityMap;
124
            	Map<Long, Long> availabilityMap;
125
            	if(itemInventory!= null) {
125
            	if(itemInventory!= null) {
-
 
126
            		System.out.println("itemId =" + item.getId());
126
	            	availabilityMap = itemInventory.getAvailability();
127
	            	availabilityMap = itemInventory.getAvailability();
127
	            	for (Long warehouseId : availabilityMap.keySet()) {
128
	            	for (Long warehouseId : availabilityMap.keySet()) {
128
	            		if(ourGoodWarehouses.contains(warehouseId)) {
129
	            		if(ourGoodWarehouses.contains(warehouseId)) {
129
	            			long currentAvailability = availabilityMap.get(warehouseId);
130
	            			long currentAvailability = availabilityMap.get(warehouseId);
-
 
131
	            			System.out.println("itemId =" + item.getId() + " availability = "+ currentAvailability);
130
	            			stockCount += currentAvailability;
132
	            			stockCount += currentAvailability;
131
	                    	if(currentAvailability>0) {
133
	                    	if(currentAvailability>0) {
132
	                    		List<VendorItemPricing> pricingList = itemPricingMap.get(item.getId());
134
	                    		List<VendorItemPricing> pricingList = itemPricingMap.get(item.getId());
133
	                    		for(VendorItemPricing vendorItemPricing: pricingList) {
135
	                    		for(VendorItemPricing vendorItemPricing: pricingList) {
134
	                    			if(vendorItemPricing.getVendorId() == ourWarehouseMap.get(warehouseId).getVendor().getId()) {
136
	                    			if(vendorItemPricing.getVendorId() == ourWarehouseMap.get(warehouseId).getVendor().getId()) {
Line 199... Line 201...
199
            	ebayAverageSale     = (double)ebayOrderCount/NUMBER_OF_DAYS_SALE;
201
            	ebayAverageSale     = (double)ebayOrderCount/NUMBER_OF_DAYS_SALE;
200
            	snapdealAverageSale = (double)snapdealOrderCount/NUMBER_OF_DAYS_SALE;
202
            	snapdealAverageSale = (double)snapdealOrderCount/NUMBER_OF_DAYS_SALE;
201
            	flipkartAverageSale = (double)flipkartOrderCount/NUMBER_OF_DAYS_SALE;
203
            	flipkartAverageSale = (double)flipkartOrderCount/NUMBER_OF_DAYS_SALE;
202
            	amzn_mfnAverageSale = (double)amzn_mfnOrderCount/NUMBER_OF_DAYS_SALE;
204
            	amzn_mfnAverageSale = (double)amzn_mfnOrderCount/NUMBER_OF_DAYS_SALE;
203
            
205
            
204
 
-
 
-
 
206
            	bufferedWriter.write('\n');
205
            	bufferedWriter.write(StringUtils.join(
207
            	bufferedWriter.write(StringUtils.join(
206
        			new String[] {
208
        			new String[] {
207
                        String.valueOf(item.getId()),
209
                        String.valueOf(item.getId()),
208
                        item.getProductGroup(),
210
                        item.getProductGroup(),
209
                        item.getBrand(),
211
                        item.getBrand(),
210
                        item.getModelName(),
212
                        item.getModelName(),
211
                        item.getModelNumber(),
213
                        item.getModelNumber(),
212
                        item.getColor(),
214
                        item.getColor(),
213
                        stockCount.toString(),
215
                        stockCount.toString(),
214
                        stockValue.toString(),
216
                        stockValue.toString(),
215
                        String.valueOf(stockCount/totalAverageSale),
217
                        new Long(new Double(stockCount/totalAverageSale).longValue()).toString(),
216
                        totalSaleHistory.substring(0, totalSaleHistory.length()-1),
218
                        totalSaleHistory.substring(0, totalSaleHistory.length()-1),
217
                        totalAverageSale.toString(),
219
                        totalAverageSale.toString(),
218
                        websiteSaleHistory.substring(0, websiteSaleHistory.length()-1),
220
                        websiteSaleHistory.substring(0, websiteSaleHistory.length()-1),
219
                        websiteAverageSale.toString(),
221
                        websiteAverageSale.toString(),
220
                        ebaySaleHistory.substring(0, ebaySaleHistory.length()-1),
222
                        ebaySaleHistory.substring(0, ebaySaleHistory.length()-1),