Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
8739 vikram.rag 1
package in.shop2020.support.controllers;
2
 
3
import in.shop2020.model.v1.catalog.CatalogService.Client;
9242 kshitij.so 4
import in.shop2020.model.v1.catalog.CatalogServiceException;
5
import in.shop2020.model.v1.catalog.Item;
9725 kshitij.so 6
import in.shop2020.model.v1.catalog.MarketplaceItems;
8739 vikram.rag 7
import in.shop2020.model.v1.catalog.SnapdealItem;
9242 kshitij.so 8
import in.shop2020.model.v1.catalog.SnapdealItemDetails;
9725 kshitij.so 9
import in.shop2020.model.v1.inventory.InventoryServiceException;
10
import in.shop2020.model.v1.inventory.InventoryType;
11
import in.shop2020.model.v1.inventory.ItemInventory;
12
import in.shop2020.model.v1.inventory.Warehouse;
13
import in.shop2020.model.v1.inventory.WarehouseType;
8739 vikram.rag 14
import in.shop2020.model.v1.order.AmazonFbaSalesSnapshot;
8886 vikram.rag 15
import in.shop2020.model.v1.order.SnapdealOrder;
8739 vikram.rag 16
import in.shop2020.support.utils.ReportsUtils;
17
import in.shop2020.thrift.clients.CatalogClient;
9478 kshitij.so 18
import in.shop2020.thrift.clients.InventoryClient;
8739 vikram.rag 19
import in.shop2020.thrift.clients.TransactionClient;
9725 kshitij.so 20
import in.shop2020.utils.GmailUtils;
21
import javax.mail.MessagingException;
8739 vikram.rag 22
 
23
import java.io.BufferedInputStream;
24
import java.io.File;
25
import java.io.FileInputStream;
26
import java.io.FileNotFoundException;
27
import java.io.FileOutputStream;
28
import java.io.FileWriter;
29
import java.io.IOException;
30
import java.io.InputStream;
9242 kshitij.so 31
import java.text.DecimalFormat;
8739 vikram.rag 32
import java.util.ArrayList;
9242 kshitij.so 33
import java.util.Arrays;
8739 vikram.rag 34
import java.util.HashMap;
35
import java.util.List;
36
import java.util.Map;
37
 
38
import javax.servlet.ServletContext;
39
import javax.servlet.ServletOutputStream;
40
import javax.servlet.http.HttpServletRequest;
41
import javax.servlet.http.HttpServletResponse;
42
import javax.servlet.http.HttpSession;
43
 
44
import org.apache.commons.io.FileUtils;
45
import org.apache.commons.lang.xwork.StringUtils;
46
import org.apache.poi.hssf.usermodel.HSSFRow;
47
import org.apache.poi.hssf.usermodel.HSSFSheet;
48
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
49
import org.apache.poi.ss.usermodel.Cell;
50
import org.apache.struts2.convention.annotation.InterceptorRef;
51
import org.apache.struts2.convention.annotation.InterceptorRefs;
52
import org.apache.struts2.interceptor.ServletRequestAware;
53
import org.apache.struts2.interceptor.ServletResponseAware;
54
import org.apache.struts2.util.ServletContextAware;
55
import org.apache.thrift.TException;
56
import org.apache.thrift.transport.TTransportException;
9242 kshitij.so 57
import org.json.JSONException;
58
import org.json.JSONObject;
8739 vikram.rag 59
import org.slf4j.Logger;
60
import org.slf4j.LoggerFactory;
61
 
62
import com.opensymphony.xwork2.ValidationAwareSupport;
63
 
9242 kshitij.so 64
@SuppressWarnings("unused")
65
 
66
@InterceptorRefs({
67
	@InterceptorRef("defaultStack"),
68
	@InterceptorRef("login")
69
})
70
 
8739 vikram.rag 71
public class SnapdealListController extends ValidationAwareSupport implements ServletRequestAware ,ServletResponseAware, ServletContextAware{
9242 kshitij.so 72
	/**
73
	 * 
74
	 */
75
	private static final long serialVersionUID = 1L;
76
 
77
 
8739 vikram.rag 78
	private static Logger logger = LoggerFactory.getLogger(SnapdealListController.class);
79
 
80
 
81
	private HttpServletRequest request;
82
	private HttpServletResponse response;
83
	private HttpSession session;
84
	private ServletContext context;
85
	private String url;
86
	private String itemId;
87
	private String isSnapdealListed;
88
	private String exceptionPrice;
89
	private String warehouseId;
90
	private File file;
91
	private String errMsg;
92
	private String next;
93
	private String id;
9242 kshitij.so 94
	private String searchText;
95
	private List<SnapdealItemDetails> snapdealItems;
96
	private long searchCount;
97
	private long totalCount;
98
	private String sellingPrice;
99
	private String transferPrice;
100
	private String webisteMrp;
101
	private String webisteSellingPrice;
102
	private String isListedOnSnapdeal;
103
	private String commission;
104
	private String serviceTax;
105
	private String courierCost;
106
	private JSONObject itemObj;
107
	private String isSuppressInventoryFeed;
108
	private String isSuppressPriceFeed;
9478 kshitij.so 109
	private String maxNlc;
110
	private String sdItemCode;
9568 kshitij.so 111
	private String supc;
9725 kshitij.so 112
	private String held;
113
	private String lastUpdatedInventoryTimestamp;
114
	private String lastCheckedTimestamp;
115
	private String otherCost;
116
	private String isAutoIncrement;
117
	private String isAutoDecrement;
118
	private String isManualFavourite;
119
	private String isAutoFavourite;
120
	private String currentSp;
121
	private String currentTp;
122
	private String minPosSp;
123
	private String minPosTp;
124
	private String vat;
8739 vikram.rag 125
 
9725 kshitij.so 126
	public String getVat() {
127
		return vat;
128
	}
9242 kshitij.so 129
 
9725 kshitij.so 130
	public void setVat(String vat) {
131
		this.vat = vat;
132
	}
9242 kshitij.so 133
 
9725 kshitij.so 134
	public String getOtherCost() {
135
		return otherCost;
136
	}
137
 
138
	public void setOtherCost(String otherCost) {
139
		this.otherCost = otherCost;
140
	}
141
 
142
 
143
	public String getCurrentSp() {
144
		return currentSp;
145
	}
146
 
147
	public void setCurrentSp(String currentSp) {
148
		this.currentSp = currentSp;
149
	}
150
 
151
	public String getCurrentTp() {
152
		return currentTp;
153
	}
154
 
155
	public void setCurrentTp(String currentTp) {
156
		this.currentTp = currentTp;
157
	}
158
 
159
 
160
	public String getLastCheckedTimestamp() {
161
		return lastCheckedTimestamp;
162
	}
163
 
164
	public String getLastUpdatedInventoryTimestamp() {
165
		return lastUpdatedInventoryTimestamp;
166
	}
167
 
168
	public void setLastUpdatedInventoryTimestamp(
169
			String lastUpdatedInventoryTimestamp) {
170
		this.lastUpdatedInventoryTimestamp = lastUpdatedInventoryTimestamp;
171
	}
172
 
173
	public void setLastCheckedTimestamp(
174
			String lastCheckedTimestamp) {
175
		this.lastCheckedTimestamp = lastCheckedTimestamp;
176
	}
177
 
178
	public String getIsAutoIncrement() {
179
		return isAutoIncrement;
180
	}
181
 
182
	public void setIsAutoIncrement(String isAutoIncrement) {
183
		this.isAutoIncrement = isAutoIncrement;
184
	}
185
 
186
	public String getIsAutoDecrement() {
187
		return isAutoDecrement;
188
	}
189
 
190
	public void setIsAutoDecrement(String isAutoDecrement) {
191
		this.isAutoDecrement = isAutoDecrement;
192
	}
193
 
194
	public String getIsManualFavourite() {
195
		return isManualFavourite;
196
	}
197
 
198
	public void setIsManualFavourite(String isManualFavourite) {
199
		this.isManualFavourite = isManualFavourite;
200
	}
201
 
202
	public String getIsAutoFavourite() {
203
		return isAutoFavourite;
204
	}
205
 
206
	public void setIsAutoFavourite(String isAutoFavourite) {
207
		this.isAutoFavourite = isAutoFavourite;
208
	}
209
 
210
	public String getMinPosSp() {
211
		return minPosSp;
212
	}
213
 
214
	public void setMinPosSp(String minPosSp) {
215
		this.minPosSp = minPosSp;
216
	}
217
 
218
	public String getMinPosTp() {
219
		return minPosTp;
220
	}
221
 
222
	public void setMinPosTp(String minPosTp) {
223
		this.minPosTp = minPosTp;
224
	}
225
 
226
	public String getHeld() {
227
		return held;
228
	}
229
 
230
	public void setHeld(String held) {
231
		this.held = held;
232
	}
233
 
9568 kshitij.so 234
	public String getSupc() {
235
		return supc;
236
	}
237
 
238
	public void setSupc(String supc) {
239
		this.supc = supc;
240
	}
241
 
9478 kshitij.so 242
	public String getSdItemCode() {
243
		return sdItemCode;
244
	}
245
 
246
	public void setSdItemCode(String sdItemCode) {
247
		this.sdItemCode = sdItemCode;
248
	}
249
 
8739 vikram.rag 250
	public String index() {
251
		if (!ReportsUtils.canAccessReport((Long) session.getAttribute(ReportsUtils.ROLE),request.getServletPath())) {
252
			return "authfail";
253
		}
254
		return "index";
255
	}
256
 
9242 kshitij.so 257
	public String edit() {
258
		if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1])) {
259
			return "authfail";
260
		}
261
		return "edit";
262
	}
263
 
264
	public String fetchItems() throws TException {
265
		Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
266
		if (searchText.length() == 0) {
267
			snapdealItems = CatalogClient.getSnapdealItems(Long.valueOf(next), 10);
268
			totalCount = CatalogClient.getCountForSnapdealItems();
269
			setSearchCount(totalCount);
270
		} else {
271
			List<String> subString = Arrays.asList(searchText.split(" "));
272
			snapdealItems = CatalogClient.searchSnapdealItems(subString,Long.valueOf(next), 10);
273
			totalCount = CatalogClient.getCountForSnapdealItems();
274
			searchCount = CatalogClient.getSnapdealSearchResultCount(subString);
275
		}
276
		return "snapdeal-item-table";
277
	}
278
 
279
	public SnapdealItemDetails fetchItemDetail() throws NumberFormatException, TException {
280
		Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
9725 kshitij.so 281
		SnapdealItemDetails sdItemDetails = CatalogClient.getSnapdealItemDetails(Long.valueOf(id));
282
		lastUpdatedInventoryTimeStampForItem(sdItemDetails.getLastUpdatedInventoryTimestamp());
283
		return sdItemDetails;
9242 kshitij.so 284
	}
285
 
9725 kshitij.so 286
	public MarketplaceItems fetchMarketplaceDetail() throws NumberFormatException, TException {
287
		Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
288
		MarketplaceItems mpItemDetails = CatalogClient.getMarketplacedetailsForItem(Long.valueOf(id), 7);
289
		lastCheckedTimeStampForItem(mpItemDetails.getLastCheckedTimestamp());
290
		return mpItemDetails;
291
	}
292
 
293
	public void lastUpdatedInventoryTimeStampForItem(long timestamp){
294
		setLastUpdatedInventoryTimestamp(new java.util.Date(timestamp).toLocaleString());
295
	}
296
 
297
	public void lastCheckedTimeStampForItem(long timestamp){
298
		setLastCheckedTimestamp(new java.util.Date(timestamp).toLocaleString());
299
	}
300
 
8739 vikram.rag 301
	public String uploadBulkSheet(){
302
		if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
303
			logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
304
			return "authfail";
305
		}
306
		return "snapdeal-bulk-upload";
307
	}
9242 kshitij.so 308
 
9725 kshitij.so 309
	public void update() throws NumberFormatException, TException, InventoryServiceException, CatalogServiceException{
9242 kshitij.so 310
		Client catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
311
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
9725 kshitij.so 312
		MarketplaceItems mpItem = catalogClient.getMarketplacedetailsForItem(Long.valueOf(itemId),7);
313
		InventoryClient inventoryServiceClient = new InventoryClient();
314
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
315
		Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
316
		if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
317
			throw new InventoryServiceException();
318
		}
9242 kshitij.so 319
		boolean commit = false; 
320
		if (snapdealItem.getWarehouseId()!=Long.valueOf(warehouseId)){
321
			snapdealItem.setWarehouseId(Long.valueOf(warehouseId));
322
			commit = true;
323
		}
324
		if (snapdealItem.isIsListedOnSnapdeal()!=Boolean.valueOf(isListedOnSnapdeal)){
325
			snapdealItem.setIsListedOnSnapdeal(Boolean.valueOf(isListedOnSnapdeal));
326
			commit = true;
327
		}
328
		if (snapdealItem.isSuppressInventoryFeed()!=Boolean.valueOf(isSuppressInventoryFeed)){
329
			snapdealItem.setSuppressInventoryFeed(Boolean.valueOf(isSuppressInventoryFeed));
330
			commit = true;
331
		}
332
		if (snapdealItem.isSuppressPriceFeed()!=Boolean.valueOf(isSuppressPriceFeed)){
333
			snapdealItem.setSuppressPriceFeed(Boolean.valueOf(isSuppressPriceFeed));
334
			commit = true;
335
		}
336
		if (snapdealItem.getTransferPrice()!=Double.valueOf(transferPrice)){
337
			snapdealItem.setTransferPrice(Double.valueOf(transferPrice));
338
			commit = true;
339
		}
340
		if (snapdealItem.getExceptionPrice()!=Double.valueOf(exceptionPrice)){
341
			snapdealItem.setExceptionPrice(Double.valueOf(exceptionPrice));
342
			commit = true;
343
		}
344
		if (snapdealItem.getSellingPrice()!=Double.valueOf(sellingPrice)){
345
			snapdealItem.setSellingPrice(Double.valueOf(sellingPrice));
346
			commit = true;
347
		}
348
		if (snapdealItem.getCourierCost()!=Double.valueOf(courierCost)){
349
			snapdealItem.setCourierCost(Double.valueOf(courierCost));
350
			commit = true;
351
		}
352
		if (snapdealItem.getCommission()!=Double.valueOf(commission)){
353
			snapdealItem.setCommission(Double.valueOf(commission));
354
			commit = true;
355
		}
356
		if (snapdealItem.getServiceTax()!=Double.valueOf(serviceTax)){
357
			snapdealItem.setServiceTax(Double.valueOf(serviceTax));
358
			commit = true;
359
		}
9478 kshitij.so 360
		if (snapdealItem.getMaxNlc()!=Double.valueOf(maxNlc)){
361
			snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
362
			commit = true;
363
		}
364
		if (!StringUtils.equalsIgnoreCase(snapdealItem.getSkuAtSnapdeal(), sdItemCode)){
365
			snapdealItem.setSkuAtSnapdeal(sdItemCode);
366
			commit=true;
367
		}
9568 kshitij.so 368
		if (!StringUtils.equalsIgnoreCase(snapdealItem.getSupc(), supc)){
369
			snapdealItem.setSupc(supc);
370
			commit=true;
371
		}
9478 kshitij.so 372
 
9242 kshitij.so 373
		if (commit){
374
			catalogClient.addOrUpdateSnapdealItem(snapdealItem);
375
		}
9725 kshitij.so 376
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
377
		boolean result =catalogClient.updateMarketplaceAttributesForItem(t_mpItem);
378
		if(!result){
379
			throw new CatalogServiceException();
380
		}
381
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
382
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
383
		}
9242 kshitij.so 384
	}
385
 
9725 kshitij.so 386
	private MarketplaceItems updateMarketplaceItemDetails(MarketplaceItems mpItem){
387
		mpItem.setItemId(Long.valueOf(itemId));
388
		mpItem.setSource(7);
389
		mpItem.setVat(Double.valueOf(vat));
390
		mpItem.setCourierCost(Double.valueOf(courierCost));
391
		mpItem.setOtherCost(Double.valueOf(otherCost));
392
		mpItem.setCurrentSp(Double.valueOf(sellingPrice));
393
		mpItem.setCurrentTp(Double.valueOf(transferPrice));
394
		mpItem.setAutoDecrement(Boolean.valueOf(isAutoDecrement));
395
		mpItem.setAutoIncrement(Boolean.valueOf(isAutoIncrement));
396
		mpItem.setManualFavourite(Boolean.valueOf(isManualFavourite));
397
		mpItem.setMinimumPossibleSp(Double.valueOf(minPosSp));
398
		mpItem.setMinimumPossibleTp(Double.valueOf(minPosTp));
399
		return mpItem;
400
	}
401
 
402
	private void sendAlert(long itemId,double sp,double minSp){
403
		Item item;
404
		try{
405
			Client catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
406
			item= catalogClient.getItem(itemId);
407
		}
408
		catch(Exception e){
409
			e.printStackTrace();
410
			return;
411
		}
412
		String emailSubjectTxt="Snapdeal SP is set below Min Possible SP";
413
		String[] sendTo=new String[]{ "kshitij.sood@shop2020.in"};
414
		String text = "Item Details\nItem Id: "+itemId+"\nProduct Name: "+item.getBrand()+" "+item.getModelName()+" "+item.getModelNumber()+" "+item.getColor()+"\nSellingPrice: "+sp+"\nMinPossibleSp: "+minSp+"\nUpdated By: "+session.getAttribute(ReportsUtils.USER_NAME).toString();
415
		logger.info(text);
416
		String emailFromAddress = "build@shop2020.in";
417
		String password = "cafe@nes";
418
		GmailUtils mailer = new GmailUtils();
419
		try {
420
			mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, "");
421
		}
422
		catch (Exception e) {
423
			e.printStackTrace();
424
		}
425
	}
426
 
427
	public void addNewItem() throws TException, NumberFormatException, InventoryServiceException, CatalogServiceException{
428
		InventoryClient inventoryServiceClient = new InventoryClient();
429
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
430
		Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
431
		if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
432
			throw new InventoryServiceException();
433
		}
9242 kshitij.so 434
		SnapdealItem snapdealItem = new SnapdealItem();
435
		snapdealItem.setItem_id(Long.valueOf(itemId));
436
		snapdealItem.setWarehouseId(Long.valueOf(warehouseId));
437
		snapdealItem.setIsListedOnSnapdeal(Boolean.valueOf(isListedOnSnapdeal));
438
		snapdealItem.setSuppressInventoryFeed(Boolean.valueOf(isSuppressInventoryFeed));
439
		snapdealItem.setSuppressPriceFeed(Boolean.valueOf(isSuppressPriceFeed));
440
		snapdealItem.setTransferPrice(Double.valueOf(transferPrice));
441
		snapdealItem.setExceptionPrice(Double.valueOf(exceptionPrice));
442
		snapdealItem.setSellingPrice(Double.valueOf(sellingPrice));
443
		snapdealItem.setCourierCost(Double.valueOf(courierCost));
444
		snapdealItem.setCommission(Double.valueOf(commission));
445
		snapdealItem.setServiceTax(Double.valueOf(serviceTax));
9478 kshitij.so 446
		snapdealItem.setMaxNlc(Double.valueOf(maxNlc));
447
		snapdealItem.setSkuAtSnapdeal(sdItemCode);
9568 kshitij.so 448
		snapdealItem.setSupc(supc);
9725 kshitij.so 449
 
450
		MarketplaceItems mpItem = new MarketplaceItems();
451
		MarketplaceItems t_mpItem = updateMarketplaceItemDetails(mpItem);
9242 kshitij.so 452
		Client catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
453
		catalogClient.addOrUpdateSnapdealItem(snapdealItem);
9725 kshitij.so 454
		boolean result =catalogClient.updateMarketplaceAttributesForItem(t_mpItem);
455
		if(!result){
456
			throw new CatalogServiceException();
457
		}
458
		if (t_mpItem.getCurrentSp()< t_mpItem.getMinimumPossibleSp()){
459
			sendAlert(t_mpItem.getItemId(),t_mpItem.getCurrentSp(),t_mpItem.getMinimumPossibleSp());
460
		}
9242 kshitij.so 461
	}
462
 
463
	public String getAddNewItemForm(){
464
		return "snapdeal-add-item";
465
	}
466
 
9725 kshitij.so 467
	public String getItemDetailsInJson() throws NumberFormatException, CatalogServiceException, TException, JSONException, InventoryServiceException{
9242 kshitij.so 468
		Client catalogClient =new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
469
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
470
		if (snapdealItem.getItem_id()!=0){
471
			throw new CatalogServiceException();
472
		}
473
		Item item = catalogClient.getItem(Long.valueOf(itemId));
474
		if (item.getId()==0){
475
			throw new CatalogServiceException();
476
		}
9478 kshitij.so 477
		InventoryClient inventoryServiceClient = new InventoryClient();
478
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
9725 kshitij.so 479
		Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
480
		if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
481
			throw new InventoryServiceException();
482
		}
9478 kshitij.so 483
		double maxNLC = inventoryClient.getNlcForWarehouse(Long.valueOf(warehouseId), Long.valueOf(itemId));
9242 kshitij.so 484
		itemObj = new JSONObject();
485
		itemObj.put("ItemId", item.getId());
486
		itemObj.put("Brand", item.getBrand());
487
		itemObj.put("ModelName", item.getModelName());
488
		itemObj.put("ModelNumber", item.getModelNumber());
489
		itemObj.put("Color", item.getColor());
490
		itemObj.put("Weight", item.getWeight());
491
		itemObj.put("Risky", item.isRisky());
492
		itemObj.put("Status", item.getItemStatus());
493
		itemObj.put("MRP", item.getMrp());
494
		itemObj.put("SellingPrice", item.getSellingPrice());
9478 kshitij.so 495
		itemObj.put("MaxNlc", maxNLC);
9242 kshitij.so 496
		return "item-details-json";
497
	}
498
 
9725 kshitij.so 499
	public String ke$ha() throws NumberFormatException, TException, JSONException, InventoryServiceException{
9478 kshitij.so 500
		InventoryClient inventoryServiceClient = new InventoryClient();
501
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
9725 kshitij.so 502
		Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
503
		if (warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD){
504
			double maxNLC = inventoryClient.getNlcForWarehouse(Long.valueOf(warehouseId), Long.valueOf(itemId));
505
			itemObj = new JSONObject();
506
			itemObj.put("ItemId", itemId);
507
			itemObj.put("WarehouseId", warehouseId);
508
			itemObj.put("MaxNlc", maxNLC);
509
		}
510
		else{
511
			itemObj = new JSONObject();
512
			throw new InventoryServiceException();
513
		}
9478 kshitij.so 514
		return "item-details-json";
515
	}
516
 
9725 kshitij.so 517
	public ItemInventory getItemInventory(String itemId) throws NumberFormatException, InventoryServiceException, TException{
518
		try{
519
			InventoryClient inventoryServiceClient = new InventoryClient();
520
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
521
			in.shop2020.model.v1.inventory.ItemInventory thriftItemInventory = inventoryClient.getItemInventoryByItemId(Long.valueOf(itemId));
522
			return thriftItemInventory;
523
		}
524
		catch(Exception e){
525
			logger.error("Unable to get inventory info for item",e);
526
			return null;
527
		}
528
	}
529
 
530
	public Warehouse getWarehouse(String warehouseId) throws NumberFormatException, TException, InventoryServiceException { 
531
		InventoryClient inventoryServiceClient = new InventoryClient();
532
		return inventoryServiceClient.getClient().getWarehouse(Long.valueOf(warehouseId));
533
	}
534
 
535
	public void changeHeldForSource() throws NumberFormatException, TException, InventoryServiceException{
536
		InventoryClient inventoryServiceClient = new InventoryClient();
537
		Warehouse warehouse = inventoryServiceClient.getClient().getWarehouse(Long.valueOf(warehouseId));
538
		if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
539
			throw new InventoryServiceException();
540
		}
541
		inventoryServiceClient.getClient().addUpdateHoldInventory(Long.valueOf(itemId),Long.valueOf(warehouseId),Long.valueOf(held),7);
542
	}
543
 
8739 vikram.rag 544
	public void downloadSnapdealListings() throws IOException, TException{
545
		File file = new File("/tmp/snapdeal-bulk-upload-template.xls");
546
		HSSFWorkbook hwb=new HSSFWorkbook();
547
		HSSFSheet sheet =  hwb.createSheet("Snapdeal-Listings");
548
		HSSFRow rowhead=   sheet.createRow((short)0);
549
		rowhead.createCell((short) 0).setCellValue("ITEM-ID");
550
		rowhead.createCell((short) 1).setCellValue("WAREHOUSE-ID");
551
		rowhead.createCell((short) 2).setCellValue("EXCEPTIONAL-PRICE");
552
		rowhead.createCell((short) 3).setCellValue("SNAPDEAL-LISTED");
9242 kshitij.so 553
		rowhead.createCell((short) 4).setCellValue("TRANSFER-PRICE");
554
		rowhead.createCell((short) 5).setCellValue("SELLING-PRICE");
555
		rowhead.createCell((short) 6).setCellValue("COURIER-COST");
556
		rowhead.createCell((short) 7).setCellValue("COMMISION");
557
		rowhead.createCell((short) 8).setCellValue("SERVICE-TAX");
9568 kshitij.so 558
		rowhead.createCell((short) 9).setCellValue("Suppress Inventory Feed");
559
		rowhead.createCell((short) 10).setCellValue("Suppress Price Feed");
560
		rowhead.createCell((short) 11).setCellValue("Max NLC");
561
		rowhead.createCell((short) 12).setCellValue("SKU @ Snapdeal");
562
		rowhead.createCell((short) 13).setCellValue("SUPC");
8739 vikram.rag 563
		CatalogClient catalogServiceClient = null;
9242 kshitij.so 564
		List<SnapdealItemDetails> snapdealItems = null;
8739 vikram.rag 565
		try {
9242 kshitij.so 566
			catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
8739 vikram.rag 567
			in.shop2020.model.v1.catalog.CatalogService.Client catalogClient= catalogServiceClient.getClient();
568
			snapdealItems = catalogClient.getAllSnapdealItems();
569
		} catch (Exception e) {
570
			e.printStackTrace();
571
		}
572
		int iterator=1;
9242 kshitij.so 573
		for(SnapdealItemDetails snapdealItem:snapdealItems){
8739 vikram.rag 574
			HSSFRow row = sheet.createRow((short)iterator);
575
			row.createCell((short) 0).setCellValue(snapdealItem.getItem_id());
576
			row.createCell((short) 1).setCellValue(snapdealItem.getWarehouseId());
577
			row.createCell((short) 2).setCellValue(snapdealItem.getExceptionPrice());
578
			if(snapdealItem.isIsListedOnSnapdeal()){
579
				row.createCell((short) 3).setCellValue(1);
580
			}
581
			else{
582
				row.createCell((short) 3).setCellValue(0);
583
			}
9242 kshitij.so 584
			row.createCell((short) 4).setCellValue(snapdealItem.getTransferPrice());
585
			row.createCell((short) 5).setCellValue(snapdealItem.getSellingPrice());
9579 kshitij.so 586
			row.createCell((short) 6).setCellValue(snapdealItem.getCourierCost());
587
			row.createCell((short) 7).setCellValue(snapdealItem.getCommission());
588
			row.createCell((short) 8).setCellValue(snapdealItem.getServiceTax());
589
			row.createCell((short) 9).setCellValue(snapdealItem.isSuppressInventoryFeed());
590
			row.createCell((short) 10).setCellValue(snapdealItem.isSuppressPriceFeed());
591
			row.createCell((short) 11).setCellValue(snapdealItem.getMaxNlc());
592
			row.createCell((short) 12).setCellValue(snapdealItem.getSkuAtSnapdeal());
593
			row.createCell((short) 13).setCellValue(snapdealItem.getSupc());
8739 vikram.rag 594
			iterator++;
595
		}
9242 kshitij.so 596
 
8739 vikram.rag 597
		FileOutputStream fileOut = null;
598
		try {
599
			fileOut = new FileOutputStream(file);
600
		} catch (FileNotFoundException e) {
601
			// TODO Auto-generated catch block
602
			e.printStackTrace();
603
		}
604
		try {
605
			hwb.write(fileOut);
606
		} catch (IOException e) {
607
			// TODO Auto-generated catch block
608
			e.printStackTrace();
609
		}
610
		try {
611
			fileOut.close();
612
		} catch (IOException e) {
613
			// TODO Auto-generated catch block
614
			e.printStackTrace();
615
		}
616
		byte[] buffer = new byte[(int)file.length()];
617
		InputStream input = null;
618
		try {
619
			int totalBytesRead = 0;
620
			input = new BufferedInputStream(new FileInputStream(file));
621
			while(totalBytesRead < buffer.length){
622
				int bytesRemaining = buffer.length - totalBytesRead;
623
				int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
624
				if (bytesRead > 0){
625
					totalBytesRead = totalBytesRead + bytesRead;
626
				}
627
			}
628
		}
629
		finally {
630
			input.close();
631
			file.delete();
632
		}
633
 
634
		response.setHeader("Content-Disposition", "attachment; filename=\"Snapdeal-Bulk-Listings.xls\"");
635
		response.setContentType("application/octet-stream");
636
		ServletOutputStream sos;
637
		try {
638
			sos = response.getOutputStream();
639
			sos.write(buffer);
640
			sos.flush();
641
		} catch (IOException e) {
642
			System.out.println("Unable to stream the manifest file");
643
		}   
644
 
9242 kshitij.so 645
 
8739 vikram.rag 646
	}
647
 
9725 kshitij.so 648
	public void uploadsnapdealBulkSheet() throws IOException, TException, NumberFormatException, InventoryServiceException{
8739 vikram.rag 649
		File fileToCreate = new File("/tmp/", "Snapdeal-bulk-upload.xls");
650
		FileUtils.copyFile(this.file, fileToCreate);
651
		FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
652
		HSSFWorkbook workbook = new HSSFWorkbook(iFile);
653
		HSSFSheet sheet = workbook.getSheetAt(0);
8887 vikram.rag 654
		Client catalogClient=null;
8739 vikram.rag 655
		StringBuilder sb = new StringBuilder();
656
		try {
9242 kshitij.so 657
			catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
8739 vikram.rag 658
		} catch (TTransportException e) {
659
			e.printStackTrace();
660
		}
9478 kshitij.so 661
		InventoryClient inventoryServiceClient = new InventoryClient();
662
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
8739 vikram.rag 663
		for (int iterator=(sheet.getFirstRowNum()+1);iterator<=sheet.getLastRowNum();iterator++){
664
			SnapdealItem snapdealItem =null;
9242 kshitij.so 665
			Item item = null;
8739 vikram.rag 666
			Long sku;
9595 kshitij.so 667
			boolean new_item = false;
8739 vikram.rag 668
			if (checkEmptyString(sheet.getRow(iterator).getCell(0))){
669
				continue;
670
			}
671
			else {
8791 kshitij.so 672
				sku=(long) sheet.getRow(iterator).getCell(0).getNumericCellValue();
8887 vikram.rag 673
				snapdealItem = catalogClient.getSnapdealItem(sku);
9242 kshitij.so 674
				try {
675
					item = catalogClient.getItem(sku);
676
					if (item.getId()==0){
677
						sb.append(sku + " Item not Present"+"\n");
678
						continue;
679
					}
680
				} catch (CatalogServiceException e) {
681
					sb.append(sku + " Item not Present"+"\n");
682
					continue;
683
				}
8886 vikram.rag 684
				if(snapdealItem.getItem_id()==0){
9595 kshitij.so 685
					new_item = true;
8886 vikram.rag 686
					snapdealItem = new SnapdealItem();
687
					snapdealItem.setItem_id(sku); 
688
				}
8739 vikram.rag 689
			}
9725 kshitij.so 690
 
9595 kshitij.so 691
			if (checkEmptyString(sheet.getRow(iterator).getCell(1)) && new_item){
692
				sb.append(sku + " New Listing - Warehouse Id not Present"+"\n");
693
				continue;
694
			}
9725 kshitij.so 695
 
8739 vikram.rag 696
			if (!checkEmptyString(sheet.getRow(iterator).getCell(1))){
9725 kshitij.so 697
				Warehouse warehouse = inventoryClient.getWarehouse(Long.valueOf(warehouseId));
698
				if (!(warehouse.getWarehouseType()==WarehouseType.OURS && warehouse.getInventoryType() == InventoryType.GOOD)){
699
					sb.append(sku + "Not acceptable warehouse"+"\n");
700
					continue;
701
				}
8739 vikram.rag 702
				long warehouseId = (long) sheet.getRow(iterator).getCell(1).getNumericCellValue();
9478 kshitij.so 703
				double maxNLC = inventoryClient.getNlcForWarehouse(warehouseId, item.getId());
9595 kshitij.so 704
				if (maxNLC==0){
705
					sb.append(sku + "Max Nlc can't be 0"+"\n");
706
					continue;
707
				}
8739 vikram.rag 708
				snapdealItem.setWarehouseId(warehouseId);
9478 kshitij.so 709
				snapdealItem.setMaxNlc(maxNLC);
8739 vikram.rag 710
			}
711
 
712
			if (!checkEmptyString(sheet.getRow(iterator).getCell(2))){
713
				double exceptionPrice = sheet.getRow(iterator).getCell(2).getNumericCellValue();
714
				snapdealItem.setExceptionPrice(exceptionPrice);
715
			}
716
 
717
			if (!checkEmptyString(sheet.getRow(iterator).getCell(3))){
718
				if ((long)sheet.getRow(iterator).getCell(3).getNumericCellValue()==1){
719
					snapdealItem.setIsListedOnSnapdeal(true);
720
				}
721
				if ((long)sheet.getRow(iterator).getCell(3).getNumericCellValue()==0){
722
					snapdealItem.setIsListedOnSnapdeal(false);
723
				}
724
			}
9242 kshitij.so 725
			double transferPrice = 0,sellingPrice,commission,courierCost =45,serviceTax;
726
			if (checkEmptyString(sheet.getRow(iterator).getCell(4))){
727
				sb.append(sku + " Transfer Price cannot be empty"+"\n");
728
				continue;
729
			}
730
			if (!checkEmptyString(sheet.getRow(iterator).getCell(4))){
731
				transferPrice = sheet.getRow(iterator).getCell(4).getNumericCellValue();
732
				if(transferPrice==0){
733
					sb.append(sku + " Transfer Price cannot be zero"+"\n");
734
					continue;
735
				}
736
				snapdealItem.setTransferPrice(transferPrice);
737
			}
738
 
739
			if (!checkEmptyString(sheet.getRow(iterator).getCell(5))){
740
				if ((long)sheet.getRow(iterator).getCell(5).getNumericCellValue()==1){
741
					snapdealItem.setSuppressPriceFeed(true);
742
				}
743
				if ((long)sheet.getRow(iterator).getCell(5).getNumericCellValue()==0){
744
					snapdealItem.setSuppressPriceFeed(false);
745
				}
746
			}
747
 
748
			if (!checkEmptyString(sheet.getRow(iterator).getCell(6))){
749
				if ((long)sheet.getRow(iterator).getCell(6).getNumericCellValue()==1){
750
					snapdealItem.setSuppressInventoryFeed(true);
751
				}
752
				if ((long)sheet.getRow(iterator).getCell(6).getNumericCellValue()==0){
753
					snapdealItem.setSuppressInventoryFeed(false);
754
				}
755
			}
9725 kshitij.so 756
 
9478 kshitij.so 757
			if (!checkEmptyString(sheet.getRow(iterator).getCell(7))){
9597 kshitij.so 758
				sheet.getRow(iterator).getCell(7).setCellType(Cell.CELL_TYPE_STRING);
9478 kshitij.so 759
				String snapdealItemCode = sheet.getRow(iterator).getCell(7).getStringCellValue();
760
				snapdealItem.setSkuAtSnapdeal(snapdealItemCode);
761
			}
9725 kshitij.so 762
 
9568 kshitij.so 763
			if (!checkEmptyString(sheet.getRow(iterator).getCell(8))){
9597 kshitij.so 764
				sheet.getRow(iterator).getCell(8).setCellType(Cell.CELL_TYPE_STRING);
9568 kshitij.so 765
				String supc = sheet.getRow(iterator).getCell(8).getStringCellValue();
766
				snapdealItem.setSupc(supc);
767
			}
9242 kshitij.so 768
			double weight = item.getWeight();
769
 
770
			/*
771
			 *TODO Uncomment this for pricing feed. 
772
			 * if(weight==0){
773
				sb.append(sku + " Please add weight"+"\n");
774
				continue;
775
			}*/
776
			if (weight!=0){
777
				int slabs = (int) ((weight - .001)/(.5));
778
 
779
				for(int i=0;i<slabs;i++){
780
					courierCost = courierCost + 35;
781
				}
782
			}
783
 
784
			snapdealItem.setCourierCost(courierCost);
785
			sellingPrice = roundTwoDecimals(((transferPrice + courierCost*1.1236)/(100 - 3.59*1.1236))*100);
786
			snapdealItem.setSellingPrice(sellingPrice);
787
			double commision_value = roundTwoDecimals(.0359*sellingPrice + courierCost);
788
			commission = roundTwoDecimals(((.0359*sellingPrice + courierCost)/sellingPrice)*100);
789
			snapdealItem.setCommission(commission);
790
			serviceTax = roundTwoDecimals((commision_value * .1236)); 
791
			snapdealItem.setServiceTax(serviceTax);
8888 vikram.rag 792
			if(!catalogClient.addOrUpdateSnapdealItem(snapdealItem)){
8739 vikram.rag 793
				sb.append(sku + "\n");
794
			}	
795
		}
796
		//logger.info("Amazon Bulk Map "+amazonBulkUpdate.toString());
797
		File file = new File("/tmp/amazonbulk");
798
		FileWriter writer = new FileWriter(file);
799
		writer.append(sb.toString());
800
		writer.close();
801
		byte[] buffer = new byte[(int)file.length()];
802
		InputStream input = null;
803
		try {
804
			int totalBytesRead = 0;
805
			input = new BufferedInputStream(new FileInputStream(file));
806
			while(totalBytesRead < buffer.length){
807
				int bytesRemaining = buffer.length - totalBytesRead;
808
				int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
809
				if (bytesRead > 0){
810
					totalBytesRead = totalBytesRead + bytesRead;
811
				}
812
			}
813
		}
814
		finally {
815
			input.close();
816
			file.delete();
817
		}
818
 
819
		response.setHeader("Content-Type", "text/javascript");
820
 
821
		ServletOutputStream sos;
822
		try {
823
			sos = response.getOutputStream();
824
			sos.write(buffer);
825
			sos.flush();
826
		} catch (IOException e) {
827
			System.out.println("Unable to stream the manifest file");
828
		}   
829
	}
830
 
831
	public boolean checkEmptyString(Cell cell){
832
		if (cell==null){
833
			return true;
834
		}
835
		return false;
836
	}
837
 
9242 kshitij.so 838
	double roundTwoDecimals(double d) {
839
		DecimalFormat twoPlaces = new DecimalFormat("#.##");
840
		return Double.valueOf(twoPlaces.format(d));
841
	}
842
 
843
 
8739 vikram.rag 844
	public String show() {
845
		logger.info("Before fetching role");
846
		logger.info(request.getSession().toString());
847
		logger.info(ReportsUtils.ROLE);
9725 kshitij.so 848
		logger.info(session.getAttribute(ReportsUtils.USER_NAME).toString());
8739 vikram.rag 849
		logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1]);
850
		if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1])) {
851
			logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1]);
852
			return "authfail";
853
		}
854
 
855
		if (StringUtils.equals(id, "snapdeal-options")){
856
			return "snapdeal-options";
857
		}
9242 kshitij.so 858
		if (StringUtils.equals(id, "item-table")){
859
			return "snapdeal-item-table";
860
		}
8739 vikram.rag 861
 
862
		return "id";
863
	}
864
 
865
	public void setId(String id) {
866
		this.id = id;
867
	}
868
 
869
	public HttpServletRequest getRequest() {
870
		logger.info("set request"+request.toString());
871
		return request;
872
	}
873
 
874
	public void setRequest(HttpServletRequest request) {
875
		this.request = request;
876
	}
877
 
878
	public HttpServletResponse getResponse() {
879
		return response;
880
	}
881
 
882
	public void setResponse(HttpServletResponse response) {
883
		this.response = response;
884
	}
885
 
886
	public HttpSession getSession() {
887
		return session;
888
	}
889
 
890
	public void setSession(HttpSession session) {
891
		logger.info("set session"+session.toString());
892
		this.session = session;
893
	}
894
 
895
	public ServletContext getContext() {
896
		return context;
897
	}
898
 
899
	public void setContext(ServletContext context) {
900
		this.context = context;
901
	}
902
 
903
	public String getUrl() {
904
		return url;
905
	}
906
 
907
	public void setUrl(String url) {
908
		this.url = url;
909
	}
910
 
911
	public String getItemId() {
912
		return itemId;
913
	}
914
 
915
	public void setItemId(String itemId) {
916
		this.itemId = itemId;
917
	}
918
 
919
	public String getIsSnapdealListed() {
920
		return isSnapdealListed;
921
	}
922
 
923
	public void setIsSnapdealListed(String isSnapdealListed) {
924
		this.isSnapdealListed = isSnapdealListed;
925
	}
926
 
927
	public String getExceptionPrice() {
928
		return exceptionPrice;
929
	}
930
 
931
	public void setExceptionPrice(String exceptionPrice) {
932
		this.exceptionPrice = exceptionPrice;
933
	}
934
 
935
	public String getWarehouseId() {
936
		return warehouseId;
937
	}
938
 
939
	public void setWarehouseId(String warehouseId) {
940
		this.warehouseId = warehouseId;
941
	}
942
 
943
	public File getFile() {
944
		return file;
945
	}
946
 
947
	public void setFile(File file) {
948
		this.file = file;
949
	}
950
 
951
	public String getErrMsg() {
952
		return errMsg;
953
	}
954
 
955
	public void setErrMsg(String errMsg) {
956
		this.errMsg = errMsg;
957
	}
958
 
959
	public String getNext() {
960
		return next;
961
	}
962
 
963
	public void setNext(String next) {
964
		this.next = next;
965
	}
966
 
967
	public String getId() {
968
		return id;
969
	}
970
 
971
	public void setServletRequest(HttpServletRequest req) {
972
		this.request = req;
973
		this.session = req.getSession();        
974
	}
975
 
976
	public void setServletContext(ServletContext arg0) {
977
		// TODO Auto-generated method stub
978
 
979
	}
980
 
981
	public void setServletResponse(HttpServletResponse response) {
982
		this.response = response;
983
	}
984
 
9242 kshitij.so 985
	public void setSearchText(String searchText) {
986
		this.searchText = searchText;
987
	}
988
 
989
	public String getSearchText() {
990
		return searchText;
991
	}
992
 
993
	public long getSearchCount() {
994
		return searchCount;
995
	}
996
 
997
	public long getTotalCount() {
998
		return totalCount;
999
	}
1000
 
1001
	public void setSearchCount(long count) {
1002
		this.searchCount = count;
1003
	}
1004
 
1005
	public List<SnapdealItemDetails> getSnapdealItems(){
1006
		return snapdealItems;
1007
	}
1008
 
1009
	public void setSellingPrice(String sellingPrice) {
1010
		this.sellingPrice = sellingPrice;
1011
	}
1012
 
1013
	public String getSellingPrice() {
1014
		return sellingPrice;
1015
	}
1016
 
1017
	public void setTransferPrice(String transferPrice) {
1018
		this.transferPrice = transferPrice;
1019
	}
1020
 
1021
	public String getTransferPrice() {
1022
		return transferPrice;
1023
	}
1024
 
1025
	public void setWebisteMrp(String webisteMrp) {
1026
		this.webisteMrp = webisteMrp;
1027
	}
1028
 
1029
	public String getWebisteMrp() {
1030
		return webisteMrp;
1031
	}
1032
 
1033
	public void setWebisteSellingPrice(String webisteSellingPrice) {
1034
		this.webisteSellingPrice = webisteSellingPrice;
1035
	}
1036
 
1037
	public String getWebisteSellingPrice() {
1038
		return webisteSellingPrice;
1039
	}
1040
 
1041
	public void setIsListedOnSnapdeal(String isListedOnSnapdeal) {
1042
		this.isListedOnSnapdeal = isListedOnSnapdeal;
1043
	}
1044
 
1045
	public String getIsSuppressInventoryFeed() {
1046
		return isSuppressInventoryFeed;
1047
	}
1048
 
1049
	public void setIsSuppressInventoryFeed(String isSuppressInventoryFeed) {
1050
		this.isSuppressInventoryFeed = isSuppressInventoryFeed;
1051
	}
1052
 
1053
	public String getIsSuppressPriceFeed() {
1054
		return isSuppressPriceFeed;
1055
	}
1056
 
1057
	public void setIsSuppressPriceFeed(String isSuppressPriceFeed) {
1058
		this.isSuppressPriceFeed = isSuppressPriceFeed;
1059
	}
1060
 
1061
	public String getIsListedOnSnapdeal() {
1062
		return isListedOnSnapdeal;
1063
	}
1064
 
1065
	public void setCommission(String commission) {
1066
		this.commission = commission;
1067
	}
1068
 
1069
	public String getCommission() {
1070
		return commission;
1071
	}
1072
 
1073
	public void setServiceTax(String serviceTax) {
1074
		this.serviceTax = serviceTax;
1075
	}
1076
 
1077
	public String getServiceTax() {
1078
		return serviceTax;
1079
	}
1080
 
1081
	public void setCourierCost(String courierCost) {
1082
		this.courierCost = courierCost;
1083
	}
1084
 
1085
	public String getCourierCost() {
1086
		return courierCost;
1087
	}
1088
 
9478 kshitij.so 1089
	public void setMaxNlc(String maxNlc) {
1090
		this.maxNlc = maxNlc;
1091
	}
1092
 
1093
	public String getMaxNlc() {
1094
		return maxNlc;
1095
	}
1096
 
9242 kshitij.so 1097
	public String getItemDetails(){
1098
		return itemObj.toString();
1099
	}
1100
 
9725 kshitij.so 1101
	public double getRoundOfValue(String val){
1102
		return roundTwoDecimals(Double.valueOf(val));
1103
	}
9242 kshitij.so 1104
 
1105
 
9725 kshitij.so 1106
 
9242 kshitij.so 1107
}