Subversion Repositories SmartDukaan

Rev

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

Rev 5554 Rev 6791
Line 202... Line 202...
202
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
202
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
203
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
203
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
204
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
204
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
205
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
205
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
206
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
206
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
-
 
207
        affHeaderRow.createCell(13).setCellValue("Expected Courier Delivery Date");
207
        affHeaderRow.createCell(13).setCellValue("RTO Declare date");
208
        affHeaderRow.createCell(14).setCellValue("RTO Declare date");
208
        affHeaderRow.createCell(14).setCellValue("Return Receive Date");
209
        affHeaderRow.createCell(15).setCellValue("Return Receive Date");
209
        affHeaderRow.createCell(15).setCellValue("RTO Refund Date");
210
        affHeaderRow.createCell(16).setCellValue("RTO Refund Date");
210
        affHeaderRow.createCell(16).setCellValue("RTO Reship Date");
211
        affHeaderRow.createCell(17).setCellValue("RTO Reship Date");
211
        
212
        
212
        affHeaderRow.createCell(17).setCellValue("Shipping to Return Time");
213
        affHeaderRow.createCell(18).setCellValue("Shipping to Return Time");
213
        affHeaderRow.createCell(18).setCellValue("First Attempt Delay");
214
        affHeaderRow.createCell(19).setCellValue("First Attempt Delay");
214
        
215
        
215
        for (int i=0; i<19 ;i++) {
216
        for (int i=0; i<20 ;i++) {
216
            affHeaderRow.getCell(i).setCellStyle(style);
217
            affHeaderRow.getCell(i).setCellStyle(style);
217
        }
218
        }
218
        
219
        
219
        try {
220
        try {
220
            TransactionClient tc = new TransactionClient();
221
            TransactionClient tc = new TransactionClient();
Line 264... Line 265...
264
            commContentRow.getCell(11).setCellStyle(dateCellStyle);
265
            commContentRow.getCell(11).setCellStyle(dateCellStyle);
265
            
266
            
266
            commContentRow.createCell(12).setCellValue(new Date(order.getExpected_delivery_time()));
267
            commContentRow.createCell(12).setCellValue(new Date(order.getExpected_delivery_time()));
267
            commContentRow.getCell(12).setCellStyle(dateCellStyle);
268
            commContentRow.getCell(12).setCellStyle(dateCellStyle);
268
            
269
            
-
 
270
            commContentRow.createCell(13).setCellValue(new Date(order.getCourier_delivery_time()));
-
 
271
            commContentRow.getCell(13).setCellStyle(dateCellStyle);
-
 
272
 
269
            if (order.getDelivery_timestamp() != 0) {
273
            if (order.getDelivery_timestamp() != 0) {
270
                //When our courier partners declare a shipment as RTO we mark that time as delivered timestamp in our DB.
274
                //When our courier partners declare a shipment as RTO we mark that time as delivered timestamp in our DB.
271
                commContentRow.createCell(13).setCellValue(new Date(order.getDelivery_timestamp()));//This is actually RTO Declare date.
275
                commContentRow.createCell(14).setCellValue(new Date(order.getDelivery_timestamp()));//This is actually RTO Declare date.
272
                commContentRow.getCell(13).setCellStyle(dateCellStyle);
-
 
273
            } else {
-
 
274
                commContentRow.createCell(13).setCellValue("N/A");
-
 
275
            }
-
 
276
            
-
 
277
            if (order.getReceived_return_timestamp() != 0) {
-
 
278
                commContentRow.createCell(14).setCellValue(new Date(order.getReceived_return_timestamp()));
-
 
279
                commContentRow.getCell(14).setCellStyle(dateCellStyle);
276
                commContentRow.getCell(14).setCellStyle(dateCellStyle);
280
            } else {
277
            } else {
281
                commContentRow.createCell(14).setCellValue("N/A");
278
                commContentRow.createCell(14).setCellValue("N/A");
282
            }
279
            }
283
            
280
            
284
            if (order.getRefund_timestamp() != 0) {
281
            if (order.getReceived_return_timestamp() != 0) {
285
                commContentRow.createCell(15).setCellValue(new Date(order.getRefund_timestamp()));
282
                commContentRow.createCell(15).setCellValue(new Date(order.getReceived_return_timestamp()));
286
                commContentRow.getCell(15).setCellStyle(dateCellStyle);
283
                commContentRow.getCell(15).setCellStyle(dateCellStyle);
287
            } else {
284
            } else {
288
                commContentRow.createCell(15).setCellValue("N/A");
285
                commContentRow.createCell(15).setCellValue("N/A");
289
            }
286
            }
290
            
287
            
291
            if (order.getReship_timestamp() != 0) {
288
            if (order.getRefund_timestamp() != 0) {
292
                commContentRow.createCell(16).setCellValue(new Date(order.getReship_timestamp()));
289
                commContentRow.createCell(16).setCellValue(new Date(order.getRefund_timestamp()));
293
                commContentRow.getCell(16).setCellStyle(dateCellStyle);
290
                commContentRow.getCell(16).setCellStyle(dateCellStyle);
294
            } else {
291
            } else {
295
                commContentRow.createCell(16).setCellValue("N/A");
292
                commContentRow.createCell(16).setCellValue("N/A");
296
            }
293
            }
297
            
294
            
-
 
295
            if (order.getReship_timestamp() != 0) {
298
            long delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
296
                commContentRow.createCell(17).setCellValue(new Date(order.getReship_timestamp()));
-
 
297
                commContentRow.getCell(17).setCellStyle(dateCellStyle);
-
 
298
            } else {
-
 
299
                commContentRow.createCell(17).setCellValue("N/A");
-
 
300
            }
299
            
301
            
300
            if (order.getReceived_return_timestamp() != 0) {
302
            if (order.getReceived_return_timestamp() != 0) {
301
                diffDays = GetDelayinDays(order.getReceived_return_timestamp(), order.getShipping_timestamp());
303
                diffDays = GetDelayinDays(order.getReceived_return_timestamp(), order.getShipping_timestamp());
302
                commContentRow.createCell(17).setCellValue(diffDays);
304
                commContentRow.createCell(18).setCellValue(diffDays);
303
            } else {
305
            } else {
304
                commContentRow.createCell(17).setCellValue("N/A");
306
                commContentRow.createCell(18).setCellValue("N/A");
305
            }
307
            }
306
            
308
            
307
            if (order.getFirst_attempt_timestamp() != 0) {
309
            if (order.getFirst_attempt_timestamp() != 0) {
308
                diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getExpected_delivery_time());
310
                diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getCourier_delivery_time());
309
                commContentRow.createCell(18).setCellValue(diffDays - delayInShipping);
311
                commContentRow.createCell(19).setCellValue(diffDays);
310
            } else {
312
            } else {
311
                commContentRow.createCell(18).setCellValue("N/A");
313
                commContentRow.createCell(19).setCellValue("N/A");
312
            }
314
            }
313
        }
315
        }
314
        for (int i = 0; i<19; i++) {
316
        for (int i = 0; i<20; i++) {
315
            sheet1.autoSizeColumn(i);
317
            sheet1.autoSizeColumn(i);
316
        }
318
        }
317
    }
319
    }
318
    
320
    
319
    private void createDeliveredSheet(Workbook wb, 
321
    private void createDeliveredSheet(Workbook wb, 
Line 353... Line 355...
353
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
355
        affHeaderRow.createCell(8).setCellValue("Promised Shipping Date");
354
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
356
        affHeaderRow.createCell(9).setCellValue("Shipping Date");
355
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
357
        affHeaderRow.createCell(10).setCellValue("First Delivery Attempt");
356
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
358
        affHeaderRow.createCell(11).setCellValue("Promised Delivery Date");
357
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
359
        affHeaderRow.createCell(12).setCellValue("Expected Delivery Date");
-
 
360
        affHeaderRow.createCell(13).setCellValue("Expected Courier Delivery Date");
358
        affHeaderRow.createCell(13).setCellValue("Delivery Date");
361
        affHeaderRow.createCell(14).setCellValue("Delivery Date");
359
        
362
        
360
        affHeaderRow.createCell(14).setCellValue("Delay");
363
        affHeaderRow.createCell(15).setCellValue("Delay");
361
        affHeaderRow.createCell(15).setCellValue("First Attempt Delay");
364
        affHeaderRow.createCell(16).setCellValue("First Attempt Delay");
362
 
365
 
363
        for (int i=0; i<16 ;i++) {
366
        for (int i=0; i<16 ;i++) {
364
            affHeaderRow.getCell(i).setCellStyle(style);
367
            affHeaderRow.getCell(i).setCellStyle(style);
365
        }
368
        }
366
 
369
 
Line 421... Line 424...
421
                commContentRow.getCell(12).setCellStyle(dateCellStyle);
424
                commContentRow.getCell(12).setCellStyle(dateCellStyle);
422
            } else {
425
            } else {
423
                commContentRow.createCell(12).setCellValue("N/A");
426
                commContentRow.createCell(12).setCellValue("N/A");
424
            }
427
            }
425
            
428
            
426
            if (order.getDelivery_timestamp() != 0) {    
429
            if (order.getDelivery_timestamp() != 0) { 
427
                commContentRow.createCell(13).setCellValue(new Date(order.getDelivery_timestamp()));
430
                commContentRow.createCell(13).setCellValue(new Date(order.getCourier_delivery_time()));
428
                commContentRow.getCell(13).setCellStyle(dateCellStyle);
431
                commContentRow.getCell(13).setCellStyle(dateCellStyle);
429
            } else {
432
            } else {
430
                commContentRow.createCell(13).setCellValue("N/A");
433
                commContentRow.createCell(13).setCellValue("N/A");
431
            }
434
            }
-
 
435
 
-
 
436
            if (order.getDelivery_timestamp() != 0) {    
-
 
437
                commContentRow.createCell(14).setCellValue(new Date(order.getDelivery_timestamp()));
-
 
438
                commContentRow.getCell(14).setCellStyle(dateCellStyle);
-
 
439
            } else {
-
 
440
                commContentRow.createCell(14).setCellValue("N/A");
-
 
441
            }
432
            
442
            
433
            
443
            
434
            //We are subtracting delay due to shipping from delay in delivery as it was not courier's
444
            //We are subtracting delay due to shipping from delay in delivery as it was not courier's
435
            //fault that the shipment was delayed
445
            //fault that the shipment was delayed
436
            
446
            
437
            long delayInShipping = 0;
447
            long delayInShipping = 0;
438
            long diffDays = GetDelayinDays(order.getDelivery_timestamp(), order.getExpected_delivery_time());
448
            long diffDays = GetDelayinDays(order.getDelivery_timestamp(), order.getCourier_delivery_time());
439
            
449
            
440
            if (order.getPromised_shipping_time() != 0) {
450
            if (order.getPromised_shipping_time() != 0) {
441
                delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
451
                delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
442
                commContentRow.createCell(14).setCellValue(diffDays - delayInShipping);
452
                commContentRow.createCell(15).setCellValue(diffDays - delayInShipping);
443
            } else {
453
            } else {
444
                commContentRow.createCell(14).setCellValue(diffDays);
454
                commContentRow.createCell(15).setCellValue(diffDays);
445
            }
455
            }
446
            
456
            
447
            diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getExpected_delivery_time());
457
            diffDays = GetDelayinDays(order.getFirst_attempt_timestamp(), order.getCourier_delivery_time());
448
            
458
            
449
            if (order.getFirst_attempt_timestamp() != 0) { 
459
            if (order.getFirst_attempt_timestamp() != 0) { 
450
                if (order.getPromised_shipping_time() != 0) {
460
                if (order.getPromised_shipping_time() != 0) {
451
                    delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
461
                    delayInShipping = GetDelayinDays(order.getShipping_timestamp(), order.getPromised_shipping_time());
452
                    commContentRow.createCell(15).setCellValue(diffDays - delayInShipping);
462
                    commContentRow.createCell(16).setCellValue(diffDays - delayInShipping);
453
                }
463
                }
454
            } else { 
464
            } else { 
455
                commContentRow.createCell(15).setCellValue("N/A");
465
                commContentRow.createCell(16).setCellValue("N/A");
456
            }
466
            }
457
        }
467
        }
458
        for (int i = 0; i<16; i++) {
468
        for (int i = 0; i<17; i++) {
459
            sheet2.autoSizeColumn(i);
469
            sheet2.autoSizeColumn(i);
460
        }
470
        }
461
    }
471
    }
462
    
472
    
463
    long GetDelayinDays(long actualDate, long expectedDate) {
473
    long GetDelayinDays(long actualDate, long expectedDate) {