Subversion Repositories SmartDukaan

Rev

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

Rev 3341 Rev 3343
Line 168... Line 168...
168
                        else {
168
                        else {
169
                            registerCountMap.put(date, 1l);
169
                            registerCountMap.put(date, 1l);
170
                        }
170
                        }
171
                    }
171
                    }
172
                    else if (tracklog.getEvent().equals("payment success")) {
172
                    else if (tracklog.getEvent().equals("payment success")) {
173
                        long paymentId = Long.parseLong(tracklog.getData().replaceAll("\\(*\\)", ""));
173
                        long paymentId = Long.parseLong(tracklog.getData().replaceAll("\\(.*\\)", ""));
174
                        if (Payments.contains(paymentId)) {
174
                        if (Payments.contains(paymentId)) {
175
                            continue;
175
                            continue;
176
                        }
176
                        }
177
                        Payments.add(paymentId);
177
                        Payments.add(paymentId);
178
                        Payment payment = paymentClient.getPayment(paymentId);
178
                        Payment payment = paymentClient.getPayment(paymentId);
Line 345... Line 345...
345
        affHeaderRow.createCell(3).setCellValue("Amount");
345
        affHeaderRow.createCell(3).setCellValue("Amount");
346
        for (int i=0; i<4 ;i++) {
346
        for (int i=0; i<4 ;i++) {
347
            affHeaderRow.getCell(i).setCellStyle(style);
347
            affHeaderRow.getCell(i).setCellStyle(style);
348
        }
348
        }
349
        
349
        
-
 
350
        Double totalQuantity = 0d;
-
 
351
        Double totalAmount = 0d;
350
        for(Date date : dates) {
352
        for(Date date : dates) {
351
            if (!productQuantityMap.containsKey(date)) {
353
            if (!productQuantityMap.containsKey(date)) {
352
                continue;
354
                continue;
353
            }
355
            }
354
            for (Entry<String, Double> quantityEntry : productQuantityMap.get(date).entrySet()) {
356
            for (Entry<String, Double> quantityEntry : productQuantityMap.get(date).entrySet()) {
355
                affSerialNo++;
357
                affSerialNo++;
356
                String prodName = quantityEntry.getKey();
358
                String prodName = quantityEntry.getKey();
357
                Double quantity = quantityEntry.getValue();
359
                Double quantity = quantityEntry.getValue();
358
                Double amount = productAmountMap.get(date).get(prodName);
360
                Double amount = productAmountMap.get(date).get(prodName);
-
 
361
                totalQuantity += quantity;
-
 
362
                totalAmount += amount;
359
                Row commContentRow = affSheet.createRow(affSerialNo);
363
                Row commContentRow = affSheet.createRow(affSerialNo);
360
                commContentRow.createCell(0).setCellValue(date);
364
                commContentRow.createCell(0).setCellValue(date);
361
                commContentRow.getCell(0).setCellStyle(dateCellStyle);
365
                commContentRow.getCell(0).setCellStyle(dateCellStyle);
362
                commContentRow.createCell(1).setCellValue(prodName);
366
                commContentRow.createCell(1).setCellValue(prodName);
363
                commContentRow.createCell(2).setCellValue(quantity);
367
                commContentRow.createCell(2).setCellValue(quantity);
364
                commContentRow.createCell(3).setCellValue(amount);
368
                commContentRow.createCell(3).setCellValue(amount);
365
                
369
                
366
                for (int i = 0; i<4; i++) {
-
 
367
                    affSheet.autoSizeColumn(i);
-
 
368
                }
-
 
369
            }
370
            }
370
        }
371
        }
-
 
372
        affSerialNo+=2;
-
 
373
        Row commContentRow = affSheet.createRow(affSerialNo);
-
 
374
        commContentRow.createCell(0).setCellValue("Total");
-
 
375
        commContentRow.createCell(1).setCellValue("");
-
 
376
        commContentRow.createCell(2).setCellValue(totalQuantity);
-
 
377
        commContentRow.createCell(3).setCellValue(totalAmount);
-
 
378
        
-
 
379
        for (int i = 0; i<4; i++) {
-
 
380
            affSheet.autoSizeColumn(i);
-
 
381
        }
371
    }
382
    }
372
 
383
 
373
    private void createSummarySheet(String mAffName, 
384
    private void createSummarySheet(String mAffName, 
374
            SortedSet<Date> dates,
385
            SortedSet<Date> dates,
375
            Map<Date, Long> registerCountMap,
386
            Map<Date, Long> registerCountMap,
Line 413... Line 424...
413
	    affHeaderRow.createCell(3).setCellValue("Amount");
424
	    affHeaderRow.createCell(3).setCellValue("Amount");
414
	    for (int i=0; i<4 ;i++) {
425
	    for (int i=0; i<4 ;i++) {
415
	        affHeaderRow.getCell(i).setCellStyle(style);
426
	        affHeaderRow.getCell(i).setCellStyle(style);
416
	    }
427
	    }
417
	    
428
	    
-
 
429
	    Double totalregisterCount = 0d;
-
 
430
        Double totalQuantity = 0d;
-
 
431
	    Double totalAmount = 0d;
418
		for(Date date : dates) {
432
        for(Date date : dates) {
419
		    affSerialNo++;
433
		    affSerialNo++;
420
			Row commContentRow = affSheet.createRow(affSerialNo);
434
			Row commContentRow = affSheet.createRow(affSerialNo);
421
			Long registerCount = registerCountMap.get(date);
435
			Long registerCount = registerCountMap.get(date);
422
			Double saleQuantity = saleQuantityMap.get(date);
436
			Double saleQuantity = saleQuantityMap.get(date);
423
			Double saleAmount = saleAmountMap.get(date);
437
			Double saleAmount = saleAmountMap.get(date);
Line 428... Line 442...
428
                saleQuantity = 0d;
442
                saleQuantity = 0d;
429
            }
443
            }
430
			if (saleAmount == null) {
444
			if (saleAmount == null) {
431
                saleAmount = 0d;
445
                saleAmount = 0d;
432
            }
446
            }
-
 
447
			totalregisterCount += registerCount;
-
 
448
            totalQuantity += saleQuantity;
-
 
449
			totalAmount += saleAmount;
433
			commContentRow.createCell(0).setCellValue(date);
450
            commContentRow.createCell(0).setCellValue(date);
434
			commContentRow.getCell(0).setCellStyle(dateCellStyle);
451
			commContentRow.getCell(0).setCellStyle(dateCellStyle);
435
            commContentRow.createCell(1).setCellValue(registerCount);
452
            commContentRow.createCell(1).setCellValue(registerCount);
436
			commContentRow.createCell(2).setCellValue(saleQuantity);
453
			commContentRow.createCell(2).setCellValue(saleQuantity);
437
			commContentRow.createCell(3).setCellValue(saleAmount);
454
			commContentRow.createCell(3).setCellValue(saleAmount);
438
		}
455
		}
-
 
456
        affSerialNo+=2;
-
 
457
        Row commContentRow = affSheet.createRow(affSerialNo);
-
 
458
        commContentRow.createCell(0).setCellValue("Total");
-
 
459
        commContentRow.createCell(1).setCellValue(totalregisterCount);
-
 
460
        commContentRow.createCell(2).setCellValue(totalQuantity);
-
 
461
        commContentRow.createCell(3).setCellValue(totalAmount);
-
 
462
        
439
        for (int i = 0; i<4; i++) {
463
        for (int i = 0; i<4; i++) {
440
            affSheet.autoSizeColumn(i);
464
            affSheet.autoSizeColumn(i);
441
        }
465
        }
442
	}
466
	}
443
 
467