| 992 |
varun.gupt |
1 |
package in.shop2020.support.controllers;
|
|
|
2 |
|
| 3213 |
chandransh |
3 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
| 992 |
varun.gupt |
4 |
import in.shop2020.model.v1.catalog.Warehouse;
|
|
|
5 |
import in.shop2020.model.v1.order.LineItem;
|
|
|
6 |
import in.shop2020.model.v1.order.Order;
|
| 4139 |
chandransh |
7 |
import in.shop2020.model.v1.order.ReturnOrder;
|
| 992 |
varun.gupt |
8 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 2492 |
ankur.sing |
9 |
import in.shop2020.support.utils.ReportsUtils;
|
| 3125 |
rajveer |
10 |
import in.shop2020.thrift.clients.CatalogClient;
|
|
|
11 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 992 |
varun.gupt |
12 |
|
|
|
13 |
import java.text.DateFormat;
|
|
|
14 |
import java.text.SimpleDateFormat;
|
|
|
15 |
import java.text.ParseException;
|
|
|
16 |
|
|
|
17 |
import java.io.ByteArrayOutputStream;
|
|
|
18 |
import java.io.IOException;
|
|
|
19 |
import java.util.ArrayList;
|
|
|
20 |
import java.util.Date;
|
|
|
21 |
import java.util.List;
|
|
|
22 |
|
| 2492 |
ankur.sing |
23 |
import javax.servlet.ServletContext;
|
| 992 |
varun.gupt |
24 |
import javax.servlet.ServletOutputStream;
|
|
|
25 |
import javax.servlet.http.HttpServletRequest;
|
|
|
26 |
import javax.servlet.http.HttpServletResponse;
|
| 2492 |
ankur.sing |
27 |
import javax.servlet.http.HttpSession;
|
| 992 |
varun.gupt |
28 |
|
|
|
29 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
30 |
import org.apache.poi.ss.usermodel.Cell;
|
|
|
31 |
import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
32 |
import org.apache.poi.ss.usermodel.Font;
|
| 4139 |
chandransh |
33 |
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
| 992 |
varun.gupt |
34 |
import org.apache.poi.ss.usermodel.Row;
|
|
|
35 |
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
36 |
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
37 |
import org.apache.poi.ss.util.CellRangeAddress;
|
| 2492 |
ankur.sing |
38 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
|
|
39 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
| 3936 |
chandransh |
40 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
41 |
import org.apache.struts2.convention.annotation.Results;
|
| 992 |
varun.gupt |
42 |
import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
43 |
import org.apache.struts2.interceptor.ServletResponseAware;
|
|
|
44 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
|
|
45 |
import org.apache.struts2.rest.HttpHeaders;
|
| 2492 |
ankur.sing |
46 |
import org.apache.struts2.util.ServletContextAware;
|
| 3213 |
chandransh |
47 |
import org.apache.thrift.TException;
|
|
|
48 |
import org.slf4j.Logger;
|
|
|
49 |
import org.slf4j.LoggerFactory;
|
| 992 |
varun.gupt |
50 |
|
|
|
51 |
/**
|
|
|
52 |
*
|
|
|
53 |
* @author Varun Gupta
|
|
|
54 |
* @version 1.0
|
|
|
55 |
* @description HotspotReconciliationController handles requests to generate a reconciliation
|
|
|
56 |
* report in XLS format for all the transactions with HotSpot within a given date range.
|
|
|
57 |
*
|
|
|
58 |
*/
|
|
|
59 |
|
| 2492 |
ankur.sing |
60 |
@InterceptorRefs({
|
|
|
61 |
@InterceptorRef("defaultStack"),
|
|
|
62 |
@InterceptorRef("login")
|
|
|
63 |
})
|
| 3936 |
chandransh |
64 |
@Results({
|
|
|
65 |
@Result(name="authfail", type="redirectAction", params = {"actionName" , "reports"})
|
|
|
66 |
})
|
| 2492 |
ankur.sing |
67 |
public class HotspotReconciliationController implements ServletResponseAware, ServletRequestAware, ServletContextAware {
|
|
|
68 |
|
| 3213 |
chandransh |
69 |
private static Logger logger = LoggerFactory.getLogger(HotspotReconciliationController.class);
|
|
|
70 |
|
| 4139 |
chandransh |
71 |
private enum OrderReportColumn {
|
| 2360 |
ankur.sing |
72 |
ORDER_ID(0),
|
|
|
73 |
BILLING_NUMBER(1),
|
|
|
74 |
BILLING_DATE(2),
|
|
|
75 |
CUSTOMER_NAME(3),
|
|
|
76 |
BRAND(4),
|
|
|
77 |
MODEL_NAME(5),
|
|
|
78 |
MODEL_NUMBER(6),
|
|
|
79 |
COLOR(7),
|
|
|
80 |
XFER_PRICE(8),
|
|
|
81 |
SELLING_PRICE(9);
|
| 2008 |
chandransh |
82 |
|
|
|
83 |
private int value;
|
|
|
84 |
|
| 4139 |
chandransh |
85 |
OrderReportColumn(int value) {
|
| 2008 |
chandransh |
86 |
this.value = value;
|
|
|
87 |
}
|
|
|
88 |
public int getValue(){
|
|
|
89 |
return this.value;
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
| 4139 |
chandransh |
93 |
private enum ReturnOrderReportColumn {
|
|
|
94 |
ORDER_ID(0),
|
|
|
95 |
WAREHOUSE_ID(1),
|
|
|
96 |
INVOICE_NUMBER(2),
|
|
|
97 |
PRODUCT_GROUP(3),
|
|
|
98 |
BRAND(4),
|
|
|
99 |
MODEL_NUMBER(5),
|
|
|
100 |
COLOR(6),
|
|
|
101 |
CREATED_ON(7),
|
|
|
102 |
XFER_PRICE(8);
|
|
|
103 |
|
|
|
104 |
private int value;
|
|
|
105 |
|
|
|
106 |
ReturnOrderReportColumn(int value) {
|
|
|
107 |
this.value = value;
|
|
|
108 |
}
|
|
|
109 |
public int getValue(){
|
|
|
110 |
return this.value;
|
|
|
111 |
}
|
|
|
112 |
}
|
|
|
113 |
|
| 1075 |
chandransh |
114 |
//FIXME: Read this configuration from the config server
|
| 1884 |
chandransh |
115 |
//private String hotspotReconciliationReportPath = "/HotspotReports";
|
| 992 |
varun.gupt |
116 |
|
|
|
117 |
private HttpServletRequest request;
|
|
|
118 |
private HttpServletResponse response;
|
| 2492 |
ankur.sing |
119 |
private HttpSession session;
|
|
|
120 |
private ServletContext context;
|
| 992 |
varun.gupt |
121 |
private String id;
|
|
|
122 |
|
| 4139 |
chandransh |
123 |
private final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
124 |
|
| 992 |
varun.gupt |
125 |
public HotspotReconciliationController(){
|
|
|
126 |
|
|
|
127 |
}
|
|
|
128 |
|
| 2492 |
ankur.sing |
129 |
public String index() {
|
|
|
130 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getServletPath())) {
|
| 3936 |
chandransh |
131 |
return "authfail";
|
| 2492 |
ankur.sing |
132 |
}
|
|
|
133 |
return "report";
|
| 992 |
varun.gupt |
134 |
}
|
|
|
135 |
|
|
|
136 |
// Handles the POST request (Form Submission)
|
|
|
137 |
public HttpHeaders create(){
|
|
|
138 |
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
| 3213 |
chandransh |
139 |
|
| 992 |
varun.gupt |
140 |
try {
|
|
|
141 |
//Formatting Form input parameters
|
| 3213 |
chandransh |
142 |
Date startDate = dateFormat.parse(request.getParameter("start"));
|
|
|
143 |
Date endDate = dateFormat.parse(request.getParameter("end"));
|
| 992 |
varun.gupt |
144 |
|
| 3125 |
rajveer |
145 |
CatalogClient csc = new CatalogClient();
|
| 992 |
varun.gupt |
146 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient= csc.getClient();
|
|
|
147 |
List<Warehouse> warehouses = catalogClient.getAllWarehouses(true);
|
|
|
148 |
|
| 3125 |
rajveer |
149 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 992 |
varun.gupt |
150 |
in.shop2020.model.v1.order.TransactionService.Client client = transactionServiceClient.getClient();
|
|
|
151 |
|
| 4139 |
chandransh |
152 |
List<Order> orders = new ArrayList<Order>();
|
|
|
153 |
List<ReturnOrder> returnOrders = new ArrayList<ReturnOrder>();
|
| 992 |
varun.gupt |
154 |
|
|
|
155 |
//Retrieving all the orders across all the warehouses
|
| 4139 |
chandransh |
156 |
long fromTime = startDate.getTime();
|
|
|
157 |
long toTime = endDate.getTime();
|
| 992 |
varun.gupt |
158 |
for(Warehouse warehouse : warehouses) {
|
| 4139 |
chandransh |
159 |
orders.addAll(client.getOrdersByBillingDate(null, fromTime, toTime, warehouse.getId()));
|
|
|
160 |
returnOrders.addAll(client.getReturnOrders(warehouse.getId(), fromTime, toTime));
|
| 992 |
varun.gupt |
161 |
}
|
| 3213 |
chandransh |
162 |
logger.debug("Total number of Orders: " + orders.size());
|
| 992 |
varun.gupt |
163 |
|
|
|
164 |
// Preparing XLS file for output
|
|
|
165 |
response.setContentType("application/vnd.ms-excel");
|
|
|
166 |
|
| 2008 |
chandransh |
167 |
DateFormat dateFormatForFile = new SimpleDateFormat("dd.MM.yyyy");
|
|
|
168 |
response.setHeader("Content-disposition", "inline; filename=hotspot-reconciliation-from-" + dateFormatForFile.format(startDate) + "-" + dateFormatForFile.format(endDate) + ".xls");
|
|
|
169 |
|
| 992 |
varun.gupt |
170 |
ServletOutputStream sos;
|
|
|
171 |
try {
|
| 4139 |
chandransh |
172 |
ByteArrayOutputStream baos = getReconciliationReport(orders, returnOrders, startDate, endDate);
|
| 992 |
varun.gupt |
173 |
sos = response.getOutputStream();
|
|
|
174 |
baos.writeTo(sos);
|
|
|
175 |
sos.flush();
|
|
|
176 |
} catch (IOException e) {
|
| 3213 |
chandransh |
177 |
logger.error("Error while streaming the hotspot reconciliation report", e);
|
| 992 |
varun.gupt |
178 |
}
|
|
|
179 |
|
|
|
180 |
} catch (ParseException e) {
|
| 3213 |
chandransh |
181 |
logger.error("Unable to parse the start or end date", e);
|
| 992 |
varun.gupt |
182 |
} catch (TransactionServiceException e) {
|
| 3213 |
chandransh |
183 |
logger.error("Error while getting order information from the transaction service", e);
|
|
|
184 |
} catch (InventoryServiceException e) {
|
|
|
185 |
logger.error("Error while getting the list of warehouses from the catalog service", e);
|
|
|
186 |
} catch (TException e) {
|
|
|
187 |
logger.error("Unable to get the orders or the warehouses", e);
|
|
|
188 |
} catch (Exception e) {
|
|
|
189 |
logger.error("Unexpected exception", e);
|
|
|
190 |
}
|
| 992 |
varun.gupt |
191 |
return new DefaultHttpHeaders("report");
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
| 4139 |
chandransh |
195 |
private ByteArrayOutputStream getReconciliationReport(List<Order> orders, List<ReturnOrder> returnOrders, Date startDate, Date endDate) {
|
| 992 |
varun.gupt |
196 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
|
|
197 |
|
| 4139 |
chandransh |
198 |
Workbook wb = new HSSFWorkbook();
|
| 992 |
varun.gupt |
199 |
|
| 4139 |
chandransh |
200 |
//Create the style for the title row
|
| 992 |
varun.gupt |
201 |
Font font = wb.createFont();
|
|
|
202 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
| 4139 |
chandransh |
203 |
CellStyle boldStyle = wb.createCellStyle();
|
|
|
204 |
boldStyle.setFont(font);
|
| 992 |
varun.gupt |
205 |
|
| 4139 |
chandransh |
206 |
CellStyle rightAlignStyle = wb.createCellStyle();
|
|
|
207 |
rightAlignStyle.setAlignment(CellStyle.ALIGN_RIGHT);
|
|
|
208 |
|
|
|
209 |
Sheet orderSheet = wb.createSheet("Orders");
|
|
|
210 |
Sheet returnSheet = wb.createSheet("Returns");
|
|
|
211 |
|
|
|
212 |
populateOrderSheet(orders, startDate, endDate, orderSheet, boldStyle, rightAlignStyle);
|
|
|
213 |
populateReturnOrderSheet(returnOrders, startDate, endDate, returnSheet, boldStyle, rightAlignStyle);
|
|
|
214 |
|
|
|
215 |
// Write the workbook to the output stream
|
|
|
216 |
try {
|
|
|
217 |
wb.write(baosXLS);
|
|
|
218 |
baosXLS.close();
|
|
|
219 |
} catch (IOException e) {
|
|
|
220 |
logger.error("Unable to write the hotspot reconciliation report to the byte array", e);
|
|
|
221 |
}
|
|
|
222 |
return baosXLS;
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
private void populateOrderSheet(List<Order> orders, Date startDate, Date endDate, Sheet sheet, CellStyle style, CellStyle rightAlignStyle) {
|
|
|
226 |
short serialNo = 0;
|
|
|
227 |
|
|
|
228 |
// Create the title row and put all the titles in it. Rows are 0 based.
|
| 992 |
varun.gupt |
229 |
Row titleRow = sheet.createRow(serialNo ++);
|
|
|
230 |
Cell titleCell = titleRow.createCell(0);
|
| 4139 |
chandransh |
231 |
titleCell.setCellValue("Order Reconciliation Report (" + DATE_FORMAT.format(startDate) + " - " + DATE_FORMAT.format(endDate) + ")");
|
| 992 |
varun.gupt |
232 |
titleCell.setCellStyle(style);
|
|
|
233 |
|
|
|
234 |
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
|
|
|
235 |
|
|
|
236 |
sheet.createRow(serialNo ++);
|
|
|
237 |
|
|
|
238 |
Row headerRow = sheet.createRow(serialNo ++);
|
| 4139 |
chandransh |
239 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
|
|
240 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
241 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
|
|
242 |
headerRow.createCell(OrderReportColumn.CUSTOMER_NAME.getValue()).setCellValue("Customer Name");
|
|
|
243 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
244 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
245 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
246 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
247 |
headerRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
|
|
|
248 |
headerRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue("Selling Price");
|
| 992 |
varun.gupt |
249 |
|
| 2014 |
rajveer |
250 |
sheet.createRow(serialNo ++);
|
| 992 |
varun.gupt |
251 |
double totalTransferPrice = 0.0;
|
| 2011 |
rajveer |
252 |
double totalSellingPrice = 0.0;
|
| 992 |
varun.gupt |
253 |
|
| 4139 |
chandransh |
254 |
for(Order order : orders) {
|
| 2014 |
rajveer |
255 |
Row contentRow = sheet.createRow(serialNo++);
|
| 992 |
varun.gupt |
256 |
|
|
|
257 |
LineItem lineItem = order.getLineitems().get(0);
|
|
|
258 |
double transferPrice = lineItem.getTransfer_price();
|
|
|
259 |
totalTransferPrice += transferPrice;
|
|
|
260 |
|
| 2014 |
rajveer |
261 |
double sellingPrice = lineItem.getTotal_price();
|
|
|
262 |
totalSellingPrice += sellingPrice;
|
| 2011 |
rajveer |
263 |
|
| 4139 |
chandransh |
264 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
265 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
266 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
|
|
267 |
contentRow.createCell(OrderReportColumn.CUSTOMER_NAME.getValue()).setCellValue(order.getCustomer_name());
|
|
|
268 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
269 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
270 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
271 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
272 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
|
|
|
273 |
contentRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue(sellingPrice);
|
| 992 |
varun.gupt |
274 |
}
|
|
|
275 |
sheet.createRow(serialNo ++);
|
|
|
276 |
Row contentRow = sheet.createRow(serialNo);
|
|
|
277 |
contentRow.createCell(0).setCellValue("Total Transfer Price");
|
| 4139 |
chandransh |
278 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
|
|
|
279 |
contentRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
| 992 |
varun.gupt |
280 |
sheet.addMergedRegion(new CellRangeAddress(serialNo, serialNo, 0, 5));
|
| 4139 |
chandransh |
281 |
}
|
|
|
282 |
|
|
|
283 |
private void populateReturnOrderSheet(List<ReturnOrder> returnOrders, Date startDate, Date endDate, Sheet sheet, CellStyle titleStyle, CellStyle rightAlignStyle) {
|
|
|
284 |
short serialNo = 0;
|
|
|
285 |
|
|
|
286 |
// Create the title row and put all the titles in it. Rows are 0 based.
|
|
|
287 |
Row titleRow = sheet.createRow(serialNo ++);
|
|
|
288 |
Cell titleCell = titleRow.createCell(0);
|
|
|
289 |
titleCell.setCellValue("Return Orders Reconciliation Report (" + DATE_FORMAT.format(startDate) + " - " + DATE_FORMAT.format(endDate) + ")");
|
|
|
290 |
titleCell.setCellStyle(titleStyle);
|
|
|
291 |
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
|
|
|
292 |
|
|
|
293 |
// Create the header row
|
|
|
294 |
sheet.createRow(serialNo ++);
|
|
|
295 |
Row headerRow = sheet.createRow(serialNo ++);
|
|
|
296 |
headerRow.createCell(ReturnOrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
|
|
297 |
headerRow.createCell(ReturnOrderReportColumn.WAREHOUSE_ID.getValue()).setCellValue("Warehouse Id");
|
|
|
298 |
headerRow.createCell(ReturnOrderReportColumn.INVOICE_NUMBER.getValue()).setCellValue("Invoice Number");
|
|
|
299 |
headerRow.createCell(ReturnOrderReportColumn.PRODUCT_GROUP.getValue()).setCellValue("Product Group");
|
|
|
300 |
headerRow.createCell(ReturnOrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
301 |
headerRow.createCell(ReturnOrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
302 |
headerRow.createCell(ReturnOrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
303 |
headerRow.createCell(ReturnOrderReportColumn.CREATED_ON.getValue()).setCellValue("Created On");
|
|
|
304 |
headerRow.createCell(ReturnOrderReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
// Create an empty row
|
|
|
308 |
sheet.createRow(serialNo ++);
|
|
|
309 |
|
|
|
310 |
double totalTransferPrice = 0.0;
|
|
|
311 |
for(ReturnOrder order : returnOrders) {
|
|
|
312 |
Row contentRow = sheet.createRow(serialNo++);
|
|
|
313 |
double transferPrice = order.getTransferPrice();
|
|
|
314 |
totalTransferPrice += transferPrice;
|
|
|
315 |
|
|
|
316 |
contentRow.createCell(ReturnOrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getOrderId());
|
|
|
317 |
contentRow.createCell(ReturnOrderReportColumn.WAREHOUSE_ID.getValue()).setCellValue(order.getWarehouseId());
|
|
|
318 |
contentRow.createCell(ReturnOrderReportColumn.INVOICE_NUMBER.getValue()).setCellValue(order.getInvoiceNumber());
|
|
|
319 |
contentRow.createCell(ReturnOrderReportColumn.PRODUCT_GROUP.getValue()).setCellValue(order.getProductGroup());
|
|
|
320 |
contentRow.createCell(ReturnOrderReportColumn.BRAND.getValue()).setCellValue(order.getBrand());
|
|
|
321 |
contentRow.createCell(ReturnOrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(order.getModelNumber());
|
|
|
322 |
contentRow.createCell(ReturnOrderReportColumn.COLOR.getValue()).setCellValue(order.getColor());
|
|
|
323 |
contentRow.createCell(ReturnOrderReportColumn.CREATED_ON.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreatedAt())));
|
|
|
324 |
contentRow.createCell(ReturnOrderReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
|
|
|
325 |
}
|
|
|
326 |
sheet.createRow(serialNo ++);
|
|
|
327 |
Row contentRow = sheet.createRow(serialNo);
|
|
|
328 |
Cell totalCell = contentRow.createCell(0);
|
|
|
329 |
totalCell.setCellValue("Total Transfer Price");
|
|
|
330 |
totalCell.setCellStyle(rightAlignStyle);
|
| 992 |
varun.gupt |
331 |
|
| 4139 |
chandransh |
332 |
contentRow.createCell(ReturnOrderReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
|
|
|
333 |
sheet.addMergedRegion(new CellRangeAddress(serialNo, serialNo, 0, ReturnOrderReportColumn.CREATED_ON.getValue()));
|
| 992 |
varun.gupt |
334 |
}
|
|
|
335 |
|
|
|
336 |
public String getId(){
|
|
|
337 |
return id;
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
public void setId(String id){
|
|
|
341 |
this.id = id;
|
|
|
342 |
}
|
|
|
343 |
|
|
|
344 |
@Override
|
|
|
345 |
public void setServletRequest(HttpServletRequest request) {
|
|
|
346 |
this.request = request;
|
| 2492 |
ankur.sing |
347 |
this.session = request.getSession();
|
| 992 |
varun.gupt |
348 |
}
|
|
|
349 |
|
|
|
350 |
@Override
|
|
|
351 |
public void setServletResponse(HttpServletResponse response) {
|
|
|
352 |
this.response = response;
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
private String getValueForEmptyString(String s){
|
|
|
356 |
if(s==null || s.equals(""))
|
|
|
357 |
return "-";
|
|
|
358 |
else
|
|
|
359 |
return s;
|
|
|
360 |
}
|
| 2492 |
ankur.sing |
361 |
@Override
|
|
|
362 |
public void setServletContext(ServletContext context) {
|
|
|
363 |
this.context = context;
|
|
|
364 |
}
|
|
|
365 |
|
|
|
366 |
public String getServletContextPath() {
|
|
|
367 |
return context.getContextPath();
|
|
|
368 |
}
|
| 2011 |
rajveer |
369 |
}
|