| Line 123... |
Line 123... |
| 123 |
return "authfail";
|
123 |
return "authfail";
|
| 124 |
}
|
124 |
}
|
| 125 |
if(number != null) {
|
125 |
if(number != null) {
|
| 126 |
try {
|
126 |
try {
|
| 127 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
127 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
| 128 |
setSearchResult(tClient.getOrdersForStore(number, 1, -1, -1, statuses));
|
128 |
setSearchResult(tClient.getOrdersForStore(number, Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), -1, -1, statuses));
|
| 129 |
if(searchResult.size() == 0) {
|
129 |
if(searchResult.size() == 0) {
|
| 130 |
setSearchError("Could not find any recharges with this number. Please try again.");
|
130 |
setSearchError("Could not find any orders with this number. Please try again.");
|
| 131 |
}
|
131 |
}
|
| 132 |
} catch(Exception e) {
|
132 |
} catch(Exception e) {
|
| 133 |
setSearchError("Some error occured. Please try again.");
|
133 |
setSearchError("Some error occured. Please try again.");
|
| 134 |
logger.error("Error during search", e);
|
134 |
logger.error("Error during search", e);
|
| 135 |
}
|
135 |
}
|
| Line 144... |
Line 144... |
| 144 |
}
|
144 |
}
|
| 145 |
long today = -1;
|
145 |
long today = -1;
|
| 146 |
today = new Date().getTime();
|
146 |
today = new Date().getTime();
|
| 147 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
147 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
| 148 |
statuses.add(OrderStatus.DELIVERY_SUCCESS);
|
148 |
statuses.add(OrderStatus.DELIVERY_SUCCESS);
|
| - |
|
149 |
statuses.add(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| - |
|
150 |
statuses.add(OrderStatus.ACCEPTED);
|
| - |
|
151 |
statuses.add(OrderStatus.BILLED);
|
| - |
|
152 |
|
| 149 |
List<Order> successfulOrders = tClient.getOrdersForStore(0, 1, today, today, statuses);
|
153 |
List<Order> successfulOrders = tClient.getOrdersForStore(0, Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, statuses);
|
| 150 |
statuses.clear();
|
154 |
statuses.clear();
|
| 151 |
statuses.add(OrderStatus.CANCELLED_ON_CUSTOMER_REQUEST);
|
155 |
statuses.add(OrderStatus.CANCELLED_ON_CUSTOMER_REQUEST);
|
| 152 |
statuses.add(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
|
156 |
statuses.add(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
|
| 153 |
List<Order> refundedOrders = tClient.getOrdersForStore(0, 1, today, today, statuses);
|
157 |
List<Order> refundedOrders = tClient.getOrdersForStore(0, Long.parseLong((String) request.getSession().getAttribute("STORE_ID")), today, today, statuses);
|
| 154 |
ByteArrayOutputStream baos = generateCollectionReport(successfulOrders, refundedOrders);
|
158 |
ByteArrayOutputStream baos = generateCollectionReport(successfulOrders, refundedOrders);
|
| 155 |
response.setContentType("application/vnd.ms-excel");
|
159 |
response.setContentType("application/vnd.ms-excel");
|
| 156 |
String fileName = "collection-report";
|
160 |
String fileName = "collection-report";
|
| 157 |
String todayDate = df4Filename.format(new Date(today));
|
161 |
String todayDate = df4Filename.format(new Date(today));
|
| 158 |
fileName = fileName + "-" + todayDate;
|
162 |
fileName = fileName + "-" + todayDate;
|
| Line 193... |
Line 197... |
| 193 |
contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
|
197 |
contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
|
| 194 |
contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
|
198 |
contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
|
| 195 |
contentRow.createCell(3).setCellValue(order.getStatusDescription());
|
199 |
contentRow.createCell(3).setCellValue(order.getStatusDescription());
|
| 196 |
contentRow.createCell(4).setCellValue("N/A");
|
200 |
contentRow.createCell(4).setCellValue("N/A");
|
| 197 |
contentRow.createCell(5).setCellValue(order.getTotal_amount());
|
201 |
contentRow.createCell(5).setCellValue(order.getTotal_amount());
|
| 198 |
contentRow.createCell(5).setCellValue(order.getAdvanceAmount());
|
202 |
contentRow.createCell(6).setCellValue(order.getAdvanceAmount());
|
| 199 |
}
|
203 |
}
|
| 200 |
|
204 |
|
| 201 |
for(Order order : refundedOrders) {
|
205 |
for(Order order : refundedOrders) {
|
| 202 |
serialNo++;
|
206 |
serialNo++;
|
| 203 |
Row contentRow = reportSheet.createRow((short)serialNo);
|
207 |
Row contentRow = reportSheet.createRow((short)serialNo);
|
| Line 205... |
Line 209... |
| 205 |
contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
|
209 |
contentRow.createCell(1).setCellValue(formatter.format(new Date(order.getCreated_timestamp())));
|
| 206 |
contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
|
210 |
contentRow.createCell(2).setCellValue(getProductName(order.getLineitems().get(0)));
|
| 207 |
contentRow.createCell(3).setCellValue(order.getStatusDescription());
|
211 |
contentRow.createCell(3).setCellValue(order.getStatusDescription());
|
| 208 |
contentRow.createCell(4).setCellValue(formatter.format(new Date(order.getRefund_timestamp())));
|
212 |
contentRow.createCell(4).setCellValue(formatter.format(new Date(order.getRefund_timestamp())));
|
| 209 |
contentRow.createCell(5).setCellValue(order.getTotal_amount());
|
213 |
contentRow.createCell(5).setCellValue(order.getTotal_amount());
|
| - |
|
214 |
contentRow.createCell(6).setCellValue(-order.getAdvanceAmount());
|
| 210 |
}
|
215 |
}
|
| 211 |
|
216 |
|
| 212 |
try {
|
217 |
try {
|
| 213 |
wb.write(baosXLS);
|
218 |
wb.write(baosXLS);
|
| 214 |
} catch (IOException e) {
|
219 |
} catch (IOException e) {
|