Subversion Repositories SmartDukaan

Rev

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

Rev 7343 Rev 7346
Line 135... Line 135...
135
        }
135
        }
136
        return index();
136
        return index();
137
    }
137
    }
138
    
138
    
139
    public String getCollection() throws Exception{
139
    public String getCollection() throws Exception{
140
        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
140
//        String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
141
        if(loginStatus == null || !loginStatus.equals("TRUE")){
141
//        if(loginStatus == null || !loginStatus.equals("TRUE")){
142
            return "authfail";
142
//            return "authfail";
143
        }
143
//        }
144
        long today = -1;
144
        long today = -1;
145
        today = new Date().getTime();
145
        today = new Date().getTime();
-
 
146
        List<OrderStatus> statuses = new ArrayList<OrderStatus>();
-
 
147
        statuses.add(OrderStatus.DELIVERY_SUCCESS);
-
 
148
        orders = tClient.getOrdersForStore(0, 1, today, today, statuses);
146
        List<RechargeTransaction> successfulRecharges = tClient.getRechargeTrans(Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, RechargeOrderStatus.RECHARGE_SUCCESSFUL);
149
        List<RechargeTransaction> successfulRecharges = tClient.getRechargeTrans(Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, RechargeOrderStatus.RECHARGE_SUCCESSFUL);
147
        List<RechargeTransaction> refundedRecharges = tClient.getRechargeTrans(Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, RechargeOrderStatus.RECHARGE_FAILED_REFUNDED);
150
        List<RechargeTransaction> refundedRecharges = tClient.getRechargeTrans(Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, RechargeOrderStatus.RECHARGE_FAILED_REFUNDED);
148
        ByteArrayOutputStream baos = generateCollectionReport(successfulRecharges, refundedRecharges);
151
        ByteArrayOutputStream baos = generateCollectionReport(successfulRecharges, refundedRecharges);
149
        response.setContentType("application/vnd.ms-excel");
152
        response.setContentType("application/vnd.ms-excel");
150
        String fileName = "collection-report";
153
        String fileName = "collection-report";
Line 348... Line 351...
348
            }
351
            }
349
        } catch (Exception e) {
352
        } catch (Exception e) {
350
            System.out.println(e.getMessage());
353
            System.out.println(e.getMessage());
351
        }
354
        }
352
        response.setContentType("application/pdf");
355
        response.setContentType("application/pdf");
353
        response.setHeader("Content-disposition", "attachment; filename=advance-invoice-" + 1 + ".pdf");
356
        response.setHeader("Content-disposition", "attachment; filename=advance-invoice-" + number.toString() + ".pdf");
354
 
357
 
355
        ServletOutputStream sos;
358
        ServletOutputStream sos;
356
        try {
359
        try {
357
            sos = response.getOutputStream();
360
            sos = response.getOutputStream();
358
            sos.write(buffer.array());
361
            sos.write(buffer.array());