Subversion Repositories SmartDukaan

Rev

Rev 7386 | Rev 7399 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7343 anupam.sin 1
package in.shop2020.serving.controllers;
2
 
3
 
4
import in.shop2020.model.v1.order.HotspotStore;
5
import in.shop2020.model.v1.order.LineItem;
6
import in.shop2020.model.v1.order.Order;
7
import in.shop2020.model.v1.order.OrderStatus;
8
import in.shop2020.model.v1.order.RechargeOrderStatus;
9
import in.shop2020.model.v1.order.RechargeTransaction;
7393 anupam.sin 10
import in.shop2020.model.v1.order.StoreOrderDetail;
7343 anupam.sin 11
import in.shop2020.model.v1.order.TransactionService;
12
import in.shop2020.thrift.clients.HelperClient;
13
import in.shop2020.thrift.clients.TransactionClient;
14
import in.shop2020.utils.Mail;
15
 
16
import java.io.ByteArrayOutputStream;
17
import java.io.IOException;
18
import java.nio.ByteBuffer;
19
import java.text.DateFormat;
20
import java.text.SimpleDateFormat;
21
import java.util.ArrayList;
22
import java.util.Calendar;
23
import java.util.Date;
24
import java.util.List;
25
import java.util.Random;
26
 
27
import javax.servlet.ServletContext;
28
import javax.servlet.ServletOutputStream;
29
import javax.servlet.http.HttpServletRequest;
30
import javax.servlet.http.HttpServletResponse;
31
import javax.servlet.http.HttpSession;
32
 
33
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
34
import org.apache.poi.ss.usermodel.Row;
35
import org.apache.poi.ss.usermodel.Sheet;
36
import org.apache.poi.ss.usermodel.Workbook;
7348 anupam.sin 37
import org.apache.thrift.meta_data.SetMetaData;
7343 anupam.sin 38
import org.slf4j.Logger;
39
import org.slf4j.LoggerFactory;
40
 
7386 anupam.sin 41
public class ReportController extends BaseController {
7343 anupam.sin 42
 
43
    /**
44
     * 
45
     */
46
    private static final long serialVersionUID = 1L;
47
 
48
    private static Logger logger = LoggerFactory.getLogger(ReportController.class);
49
 
50
    protected HttpServletRequest request;
51
    protected HttpSession session;
52
    protected HttpServletResponse response;
53
    private ServletContext context;
54
    private String startDate;
55
    private String endDate;
56
    private String status;
57
    private String dateselector;
58
    private String searchError = "";
59
    private Long number = null;
60
    private String passwordGeneration = "";
61
 
62
    private static final String chars = "0123456789";
63
    private static final int LENGTH = 4;
64
    private static final Random random = new Random();
65
    private TransactionClient tsc;
66
    private in.shop2020.model.v1.order.TransactionService.Client tClient;
67
 
68
    private final DateFormat formatter = new SimpleDateFormat("EEE, dd-MMM-yyyy hh:mm a");
69
    private final DateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
70
    private final DateFormat df4Filename = new SimpleDateFormat("EEE_dd_MMM");
71
 
7348 anupam.sin 72
    private String returnType;
7343 anupam.sin 73
    private List<Order> orders = null;
74
    private List<Order> searchResult = null;
7348 anupam.sin 75
    private Long orderId;
7343 anupam.sin 76
 
7349 anupam.sin 77
    private Long refundAmount;
78
 
7343 anupam.sin 79
    private boolean showReprintColumn = false;
80
 
81
    public ReportController(){
7386 anupam.sin 82
        super();
7343 anupam.sin 83
        try {
84
            tsc = new TransactionClient();
85
            tClient = tsc.getClient();
86
        } catch (Exception e) {
87
            logger.error("Error connecting to one of the user, order or payment service", e);
88
        }
89
    }
90
 
91
 
92
    public String index() {
7386 anupam.sin 93
      String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
94
        if(loginStatus == null || !loginStatus.equals("TRUE")){
95
            return "authfail";
96
        }
97
 
98
        storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
7343 anupam.sin 99
        if(!hotspotStores.containsKey(storeId)){
100
            try{
101
                HotspotStore hotSpotStore = (new TransactionClient()).getClient().getHotspotStore(storeId, "");
102
                hotspotStores.put(storeId, hotSpotStore);
103
            } catch (Exception e) {
104
                logger.error("Unable to get store", e);
105
            }
106
        }
107
 
108
        long today = -1;
109
        today = new Date().getTime();
110
        try {
111
            List<OrderStatus> statuses = new ArrayList<OrderStatus>();
112
            orders = tClient.getOrdersForStore(0, storeId, today, today, statuses);
113
        } catch (Exception e) {
114
            setSearchError("Error getting all transactions for today. Please try again.");
115
            logger.error("Unable to get all Transactions for today", e);
116
        }
117
        return "index";
118
    }
119
 
7348 anupam.sin 120
    public String search() {
7386 anupam.sin 121
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
122
        if(loginStatus == null || !loginStatus.equals("TRUE")){
123
            return "authfail";
124
        }
7343 anupam.sin 125
        if(number != null) {
126
            try {
127
                List<OrderStatus> statuses = new ArrayList<OrderStatus>();
128
                setSearchResult(tClient.getOrdersForStore(number, 1, -1, -1, statuses));
129
                if(searchResult.size() == 0) {
130
                    setSearchError("Could not find any recharges with this number. Please try again.");
131
                }
132
            } catch(Exception e) {
133
                setSearchError("Some error occured. Please try again.");
134
                logger.error("Error during search", e);
135
            }
136
        }
137
        return index();
138
    }
139
 
140
    public String getCollection() throws Exception{
7386 anupam.sin 141
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
142
        if(loginStatus == null || !loginStatus.equals("TRUE")){
143
            return "authfail";
144
        }
7343 anupam.sin 145
        long today = -1;
146
        today = new Date().getTime();
7346 anupam.sin 147
        List<OrderStatus> statuses = new ArrayList<OrderStatus>();
148
        statuses.add(OrderStatus.DELIVERY_SUCCESS);
7348 anupam.sin 149
        List<Order> successfulOrders = tClient.getOrdersForStore(0, 1, today, today, statuses);
150
        statuses.clear();
151
        statuses.add(OrderStatus.CANCELLED_ON_CUSTOMER_REQUEST);
152
        statuses.add(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
153
        List<Order> refundedOrders = tClient.getOrdersForStore(0, 1, today, today, statuses);
154
        ByteArrayOutputStream baos = generateCollectionReport(successfulOrders, refundedOrders);
7343 anupam.sin 155
        response.setContentType("application/vnd.ms-excel");
156
        String fileName = "collection-report";
157
        String todayDate = df4Filename.format(new Date(today));
158
        fileName = fileName + "-" + todayDate;
159
        fileName = fileName + ".xls";
160
        response.setHeader("Content-disposition", "inline; filename=" + fileName);
161
        ServletOutputStream sos;
162
        try {
163
            sos = response.getOutputStream();
164
            baos.writeTo(sos);
165
            sos.flush();
166
        } catch (IOException e) {
167
            e.printStackTrace();
168
        }
169
        return null;
170
 
171
    }
172
 
7348 anupam.sin 173
    private ByteArrayOutputStream generateCollectionReport(List<Order> successfulOrders,
174
                                                            List<Order> refundedOrders) {
7343 anupam.sin 175
        ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
176
        Workbook wb = new HSSFWorkbook();
177
        Sheet reportSheet = wb.createSheet("Recharge Report");
178
        Row reportSheetHeader = reportSheet.createRow((short)0);
179
        reportSheetHeader.createCell(0).setCellValue("Order ID");
180
        reportSheetHeader.createCell(1).setCellValue("Order Date");
7348 anupam.sin 181
        reportSheetHeader.createCell(2).setCellValue("Product");
182
        reportSheetHeader.createCell(3).setCellValue("Status");
183
        reportSheetHeader.createCell(4).setCellValue("Refund Date");
7349 anupam.sin 184
        reportSheetHeader.createCell(5).setCellValue("Order Value");
185
        reportSheetHeader.createCell(6).setCellValue("Collected Amount");
7343 anupam.sin 186
 
187
        int serialNo = 0;
188
 
7348 anupam.sin 189
        for(Order order : successfulOrders) {
7343 anupam.sin 190
            serialNo++;
191
            Row contentRow = reportSheet.createRow((short)serialNo);
7348 anupam.sin 192
            contentRow.createCell(0).setCellValue(order.getId());
193
            contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
194
            contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
195
            contentRow.createCell(3).setCellValue(order.getStatusDescription());
196
            contentRow.createCell(4).setCellValue("N/A");
197
            contentRow.createCell(5).setCellValue(order.getTotal_amount());
7349 anupam.sin 198
            contentRow.createCell(5).setCellValue(order.getAdvanceAmount());
7343 anupam.sin 199
        }
200
 
7348 anupam.sin 201
        for(Order order : refundedOrders) {
7343 anupam.sin 202
            serialNo++;
203
            Row contentRow = reportSheet.createRow((short)serialNo);
7348 anupam.sin 204
            contentRow.createCell(0).setCellValue(order.getId());
205
            contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
206
            contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
207
            contentRow.createCell(3).setCellValue(order.getStatusDescription());
208
            contentRow.createCell(4).setCellValue(formatter.format(new Date(order.getRefund_timestamp())));
209
            contentRow.createCell(5).setCellValue(order.getTotal_amount());
7343 anupam.sin 210
        }
211
 
212
        try {
213
            wb.write(baosXLS);
214
        } catch (IOException e) {
215
            // TODO Auto-generated catch block
216
            e.printStackTrace();
217
        }
218
        return baosXLS;
219
    }
220
 
221
 
222
    public String create() throws Exception{
223
        long sDate = -1;
224
        long eDate = -1;
225
        RechargeOrderStatus st = null;
226
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
227
        if(loginStatus == null || !loginStatus.equals("TRUE")){
228
            return "authfail";
229
        }
230
        if(dateselector.equals("1")) {
231
            sDate = new Date().getTime();
232
            eDate = sDate;
233
        }else if (dateselector.equals("2")) {
234
            sDate = new Date().getTime() - 86400*1000;
235
            eDate = sDate;
236
        }else {
237
            if(!(startDate.equals(""))) {
238
                sDate = dateFormatter.parse(startDate).getTime();
239
                startDate = dateFormatter.format(sDate);
240
            }
241
            if(!endDate.equals("")) {
242
                eDate = dateFormatter.parse(endDate).getTime();
243
                endDate = dateFormatter.format(sDate);
244
            }
245
        }
246
        if(!status.equals("-1")){
247
            st = RechargeOrderStatus.findByValue(Integer.parseInt(status));
248
        }
249
 
250
        ByteArrayOutputStream baos = generateReport(tClient.getRechargeTrans(Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), sDate, eDate, st));
251
 
252
        response.setContentType("application/vnd.ms-excel");
253
        String st1 = "ALL";
254
        if(st!=null){
255
            st1 = st.name();
256
        }
257
        String fileName = st1 + "-recharge-report";
258
        if (!startDate.equals("")) {
259
            fileName = fileName + "-" + startDate.replaceAll("\\\\", "_") ;
260
        }
261
        if (!endDate.equals("")) {
262
            fileName = fileName + "-" + endDate.replaceAll("\\\\", "_") ;
263
        }
264
        fileName = fileName + ".xls";
265
        response.setHeader("Content-disposition", "inline; filename=" + fileName);
266
        ServletOutputStream sos;
267
        try {
268
            sos = response.getOutputStream();
269
            baos.writeTo(sos);
270
            sos.flush();
271
        } catch (IOException e) {
272
            e.printStackTrace();
273
        }
274
        return "index";
275
    }
276
 
277
 
278
    private ByteArrayOutputStream generateReport(
279
            List<RechargeTransaction> rechargeTrans) {
280
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
281
 
282
        Workbook wb = new HSSFWorkbook();
283
 
284
        Sheet reportSheet = wb.createSheet("Recharge Report");
285
 
286
        Row reportSheetHeader = reportSheet.createRow((short)0);
287
        reportSheetHeader.createCell(0).setCellValue("Order ID");
288
        reportSheetHeader.createCell(1).setCellValue("Order Date");
289
        reportSheetHeader.createCell(2).setCellValue("Operator");
290
        reportSheetHeader.createCell(3).setCellValue("Device");
291
        reportSheetHeader.createCell(4).setCellValue("Status");
292
        reportSheetHeader.createCell(5).setCellValue("Recharge Amount");
293
        reportSheetHeader.createCell(6).setCellValue("Discount");
294
        reportSheetHeader.createCell(7).setCellValue("Net Amount");
295
        reportSheetHeader.createCell(8).setCellValue("Type");
296
        reportSheetHeader.createCell(9).setCellValue("Pay Method");
297
        reportSheetHeader.createCell(10).setCellValue("Refund Date");
298
 
299
        int serialNo = 0;
300
 
301
        for(RechargeTransaction transaction : rechargeTrans) {
302
            serialNo++;
303
            Row contentRow = reportSheet.createRow((short)serialNo);
304
            contentRow.createCell(0).setCellValue(transaction.getId());
305
            contentRow.createCell(1).setCellValue(formatter.format(new Date(transaction.getTransactionTime())));
306
//            contentRow.createCell(2).setCellValue(getOperatorName(transaction.getOperatorId()));
307
            contentRow.createCell(3).setCellValue(transaction.getDeviceNum());
308
            contentRow.createCell(4).setCellValue(transaction.getStatus().name());
309
            contentRow.createCell(5).setCellValue(transaction.getAmount());
310
            contentRow.createCell(6).setCellValue(transaction.getDiscount());
311
            contentRow.createCell(7).setCellValue(transaction.getPaymentAmount());
312
            contentRow.createCell(8).setCellValue(transaction.isIsFrc() ? "FRC" : "Normal");
313
            contentRow.createCell(9).setCellValue(transaction.getPayMethod().name());
314
            if(transaction.getStatus() == RechargeOrderStatus.RECHARGE_FAILED_REFUNDED) {
315
                contentRow.createCell(10).setCellValue(transaction.getResponseTime());
316
            } else {
317
                contentRow.createCell(10).setCellValue("N/A");
318
            }
319
        }
320
        try {
321
            wb.write(baosXLS);
322
        } catch (IOException e) {
323
            // TODO Auto-generated catch block
324
            e.printStackTrace();
325
        }
326
        return baosXLS;
327
    }
328
 
329
    public String downloadInvoice() {
330
        ByteBuffer buffer = null;
331
        try {
332
            if (number == null || number == 0) {
333
                log.error("rechargeId is 0");
334
                return "index";
335
            }
336
            TransactionClient transactionServiceClient = new TransactionClient();
337
            TransactionService.Client orderClient = transactionServiceClient.getClient();
7386 anupam.sin 338
            //TODO : dynamically get StoreId
339
            buffer = orderClient.getStoreOrderAdvanceInvoice(number, 1);
7343 anupam.sin 340
            if(!buffer.hasArray()) {
341
                log.error("The invoice was not found for orderId : " + 1);
342
            }
343
        } catch (Exception e) {
344
            System.out.println(e.getMessage());
345
        }
346
        response.setContentType("application/pdf");
7346 anupam.sin 347
        response.setHeader("Content-disposition", "attachment; filename=advance-invoice-" + number.toString() + ".pdf");
7343 anupam.sin 348
 
349
        ServletOutputStream sos;
350
        try {
351
            sos = response.getOutputStream();
352
            sos.write(buffer.array());
353
            sos.flush();
354
        } catch (Exception e) {
355
            System.out.println("Unable to stream the invoice file");
356
        }
357
        return "index";
358
    }
359
 
360
    public String sendPassword() throws Exception {
361
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
362
        if(loginStatus == null || !loginStatus.equals("TRUE")){
363
            return "authfail";
364
        }
365
        Long storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
366
 
367
        char[] buf = new char[LENGTH];
368
        for (int i = 0; i < buf.length; i++) {
369
            buf[i] = chars.charAt(random.nextInt(chars.length()));
370
        }
371
        String password = new String(buf);
372
 
373
        try {
374
            TransactionClient tcl = new TransactionClient(); 
375
            HotspotStore hotSpotStore = tcl.getClient().getHotspotStore(storeId, "");
376
            boolean wasPasswordSet = tcl.getClient().updateHotspotStorePassword(storeId, password);
377
            if(!wasPasswordSet) {
378
                passwordGeneration = "FAIL";
379
                return index();
380
            }
381
            List<String> toList = new ArrayList<String>();
382
            toList.add(hotSpotStore.getEmail());
383
            HelperClient helperServiceClient = null;
384
            helperServiceClient = new HelperClient();
385
            in.shop2020.utils.HelperService.Client client = helperServiceClient.getClient();
386
 
387
 
388
            Mail mail = new Mail();
389
            mail.setSubject("New Password for Saholic Recharge");
390
            mail.setTo(toList);
391
            mail.setData("Your new password is : " + password);
392
            client.sendMail(mail);
393
        } catch(Exception e) {
394
            passwordGeneration = "FAIL";
395
            logger.error("Password generation/sending failed for storeId : " + storeId, e);
396
        }
397
        passwordGeneration = "SUCCESS";
398
        return index();
399
    }
400
 
401
    public String getDateTime(long milliseconds) {
402
        Calendar cal = Calendar.getInstance();
403
        cal.setTimeInMillis(milliseconds);
404
        return formatter.format(cal.getTime());
405
    }
7348 anupam.sin 406
 
407
    public String cancelRequest() {
408
        try{
409
        TransactionClient tcl = new TransactionClient();
7393 anupam.sin 410
        long storeId =  Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
411
        StoreOrderDetail sod = tcl.getClient().getStoreOrderDetail(orderId, storeId);
412
        tcl.getClient().saveRefundAmountsForStoreOrder(orderId, storeId, sod.getCashAmount(), sod.getCardAmount());
7386 anupam.sin 413
        tcl.getClient().refundOrder(orderId, "Store", "User requested for cancellation");
7348 anupam.sin 414
        } catch (Exception e) {
415
            logger.error("Could not mark order as cancellation requested for id : " + orderId.toString(), e);
416
            setSearchError("Request failed. Try again or call customer care.");
417
        }
418
        number = orderId;
419
        return search();
420
    }
421
 
422
    public String requestReturn() {
423
        try{
424
            TransactionClient tcl = new TransactionClient();
425
            if(returnType.equals("doa")) {
426
                tcl.getClient().markOrderDoaRequestReceived(orderId);
427
            } else if(returnType.equals("return")) {
428
                tcl.getClient().markOrderReturnRequestReceived(orderId);
429
            } else {
430
                setSearchError("Error in requesting return. Try Again.");
431
            }
432
        } catch (Exception e) {
433
            logger.error("Could not mark order as return requested for id : " + orderId.toString(), e);
434
            setSearchError("Request failed. Try again or call customer care.");
435
        }
436
        number = orderId;
437
        return search();
438
    }
7349 anupam.sin 439
 
440
    public String refundOrder() {
441
        number = orderId;
442
        try{
443
            TransactionClient tcl = new TransactionClient();
444
            Order order = tcl.getClient().getOrder(number);
445
            if(order.getTotal_amount() < refundAmount) {
446
                setSearchError("You cannot refund more than Rs. " + refundAmount.toString());
447
                return search();
448
            }
449
            tcl.getClient().refundOrder(orderId, "ANU", "Cancelled");
450
            setSearchError("SUCCESSFUL. Please refund Rs. " + refundAmount.toString() + " to the customer.");
451
        } catch (Exception e) {
452
            logger.error("Could not mark order as return requested for id : " + orderId.toString(), e);
453
            setSearchError("Could not refund. Try again or call customer care.");
454
        }
455
        return search();
456
    }
7343 anupam.sin 457
 
458
    public List<Order> getOrders(){
459
        return orders;
460
    }
461
 
462
    public void setServletRequest(HttpServletRequest req) {
463
        this.request = req;
464
        this.session = req.getSession();        
465
    }
466
 
467
    public void setServletContext(ServletContext context) {
468
        this.context = context;
469
    }
470
 
471
    public void setServletResponse(HttpServletResponse response) {
472
        this.response = response;
473
    }
474
 
475
    public String getServletContextPath() {
476
        return context.getContextPath();
477
    }
478
 
479
    public String getProductName(LineItem item) {
480
        return item.getBrand() 
481
                + (item.getModel_name() == null ? "" : " " + item.getModel_name())
482
                + (item.getModel_number() == null ? "" : " " + item.getModel_number())
483
                + (item.getColor() == null || item.getColor() == "" ? "" : " (" + item.getColor() + ")");
484
    }
485
 
486
    public String getStartDate() {
487
        return startDate;
488
    }
489
 
490
 
491
    public void setStartDate(String startDate) {
492
        this.startDate = startDate;
493
    }
494
 
495
    public String getEndDate() {
496
        return endDate;
497
    }
498
 
499
 
500
    public void setEndDate(String endDate) {
501
        this.endDate = endDate;
502
    }
503
 
504
    public String getStatus() {
505
        return status;
506
    }
507
 
508
 
509
    public void setStatus(String status) {
510
        this.status = status;
511
    }
512
 
513
 
514
    public String getDateselector() {
515
        return dateselector;
516
    }
517
 
518
 
519
    public void setDateselector(String dateselector) {
520
        this.dateselector = dateselector;
521
    }
522
 
523
 
524
    public void setSearchError(String searchError) {
525
        this.searchError = searchError;
526
    }
527
 
528
 
529
    public String getSearchError() {
530
        return searchError;
531
    }
532
 
533
 
534
    public void setNumber(Long number) {
535
        this.number = number;
536
    }
537
 
538
 
539
    public Long getNumber() {
540
        return number;
541
    }
542
 
543
 
544
    public void setSearchResult(List<Order> searchResult) {
545
        this.searchResult = searchResult;
546
    }
547
 
548
 
549
    public List<Order> getSearchResult() {
550
        if(searchResult == null)
551
            searchResult = new ArrayList<Order>();
552
        return searchResult;
553
    }
554
 
555
 
556
    public void setShowReprintColumn(boolean showReprintColumn) {
557
        this.showReprintColumn = showReprintColumn;
558
    }
559
 
560
 
561
    public boolean shouldShowReprintColumn() {
562
        return showReprintColumn;
563
    }
564
 
565
 
566
    public void setPasswordGeneration(String passwordGeneration) {
567
        this.passwordGeneration = passwordGeneration;
568
    }
569
 
570
 
571
    public String getPasswordGeneration() {
572
        return passwordGeneration;
573
    }
7348 anupam.sin 574
 
575
 
576
    public void setOrderId(Long orderId) {
577
        this.orderId = orderId;
578
    }
579
 
580
 
581
    public Long getOrderId() {
582
        return orderId;
583
    }
584
 
585
 
586
    public void setReturnType(String returnType) {
587
        this.returnType = returnType;
588
    }
589
 
590
 
591
    public String getReturnType() {
592
        return returnType;
593
    }
7349 anupam.sin 594
 
595
 
596
    public void setRefundAmount(Long refundAmount) {
597
        this.refundAmount = refundAmount;
598
    }
599
 
600
 
601
    public Long getRefundAmount() {
602
        return refundAmount;
603
    }
7343 anupam.sin 604
 
7386 anupam.sin 605
    public boolean isOrderPlacedOnSameDay(long orderTime) {
606
        Calendar calOrderDate = Calendar.getInstance();
607
        calOrderDate.setTimeInMillis(orderTime);
608
 
609
        Calendar cal = Calendar.getInstance();
610
        if(cal.get(Calendar.DATE) == calOrderDate.get(Calendar.DATE) 
611
                && cal.get(Calendar.MONTH) == calOrderDate.get(Calendar.MONTH)
612
                && cal.get(Calendar.YEAR) == calOrderDate.get(Calendar.YEAR)) {
613
            return true;
614
        }
615
        return false;
616
    }
7343 anupam.sin 617
 
618
}