Subversion Repositories SmartDukaan

Rev

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

Rev 8303 Rev 8488
Line 18... Line 18...
18
import in.shop2020.model.v1.order.LineItem;
18
import in.shop2020.model.v1.order.LineItem;
19
import in.shop2020.model.v1.order.Order;
19
import in.shop2020.model.v1.order.Order;
20
import in.shop2020.model.v1.order.OrderSource;
20
import in.shop2020.model.v1.order.OrderSource;
21
import in.shop2020.model.v1.order.OrderStatus;
21
import in.shop2020.model.v1.order.OrderStatus;
22
import in.shop2020.model.v1.order.OrderType;
22
import in.shop2020.model.v1.order.OrderType;
-
 
23
import in.shop2020.model.v1.order.SnapdealOrder;
23
import in.shop2020.thrift.clients.CatalogClient;
24
import in.shop2020.thrift.clients.CatalogClient;
24
import in.shop2020.thrift.clients.LogisticsClient;
25
import in.shop2020.thrift.clients.LogisticsClient;
25
import in.shop2020.thrift.clients.TransactionClient;
26
import in.shop2020.thrift.clients.TransactionClient;
26
import in.shop2020.thrift.clients.config.ConfigClient;
27
import in.shop2020.thrift.clients.config.ConfigClient;
27
import in.shop2020.thrift.clients.InventoryClient;
28
import in.shop2020.thrift.clients.InventoryClient;
Line 224... Line 225...
224
					document.add(getExtraInfoTable(order, provider, 16, warehouse.getBillingType()));
225
					document.add(getExtraInfoTable(order, provider, 16, warehouse.getBillingType()));
225
					continue;
226
					continue;
226
				}
227
				}
227
				
228
				
228
				PdfPTable dispatchAdviceTable = null;
229
				PdfPTable dispatchAdviceTable = null;
-
 
230
				
-
 
231
				if (new Long(order.getSource()).intValue() == OrderSource.SNAPDEAL.getValue()) {
229
				//TODO fix this logic
232
					dispatchAdviceTable = new PdfPTable(1);
230
				if ((new Long(order.getSource()).intValue() == OrderSource.EBAY.getValue()) && (order.getLogistics_provider_id()>7)) {
233
				} else if ((new Long(order.getSource()).intValue() == OrderSource.EBAY.getValue()) && (order.getLogistics_provider_id()>7)) {
231
					if(order.getWarehouse_id() == 7 || order.getWarehouse_id() == 5 || order.getWarehouse_id() == 9) {
234
					if(order.getWarehouse_id() == 7 || order.getWarehouse_id() == 5 || order.getWarehouse_id() == 9) {
232
						dispatchAdviceTable = new PdfPTable(1);
235
						dispatchAdviceTable = new PdfPTable(1);
233
					} else { 
236
					} else { 
234
						if (order.getAirwaybill_no()== null || order.getAirwaybill_no().equals("null") || order.getAirwaybill_no().isEmpty()) {
237
						if (order.getAirwaybill_no()== null || order.getAirwaybill_no().equals("null") || order.getAirwaybill_no().isEmpty()) {
235
							dispatchAdviceTable = new PdfPTable(1);
238
							dispatchAdviceTable = new PdfPTable(1);
Line 241... Line 244...
241
				} else {
244
				} else {
242
					dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill, shippingLocation);
245
					dispatchAdviceTable = getDispatchAdviceTable(order, warehouse, provider, barcodeFontSize, destCode, withBill, shippingLocation);
243
				}
246
				}
244
				dispatchAdviceTable.setSpacingAfter(10.0f);
247
				dispatchAdviceTable.setSpacingAfter(10.0f);
245
				dispatchAdviceTable.setWidthPercentage(90.0f);
248
				dispatchAdviceTable.setWidthPercentage(90.0f);
246
 
-
 
247
				document.add(dispatchAdviceTable);
249
				document.add(dispatchAdviceTable);
248
				//TODO fix this logic
250
				//TODO fix this logic
249
				if ((new Long(order.getSource()).intValue() == OrderSource.EBAY.getValue()) && (order.getLogistics_provider_id()>7)) {
251
				if ((new Long(order.getSource()).intValue() == OrderSource.EBAY.getValue()) && (order.getLogistics_provider_id()>7)) {
250
					if (order.getAirwaybill_no()== null || order.getAirwaybill_no().equals("null") || order.getAirwaybill_no().isEmpty() 
252
					if (order.getAirwaybill_no()== null || order.getAirwaybill_no().equals("null") || order.getAirwaybill_no().isEmpty() 
251
							|| order.getWarehouse_id() == 7 || order.getWarehouse_id() == 5 || order.getWarehouse_id() == 9) {
253
							|| order.getWarehouse_id() == 7 || order.getWarehouse_id() == 5 || order.getWarehouse_id() == 9) {
Line 263... Line 265...
263
							document.add(extraInfoTable);
265
							document.add(extraInfoTable);
264
						}
266
						}
265
					} else {
267
					} else {
266
						document.newPage();
268
						document.newPage();
267
					}
269
					}
-
 
270
				} else if (new Long(order.getSource()).intValue() == OrderSource.SNAPDEAL.getValue()) {
-
 
271
					if(withBill){
-
 
272
						PdfPTable taxTable = getTaxCumRetailInvoiceTable(order, provider, shippingLocation.getLocation() + "-" + shippingLocation.getPincode() , shippingLocation.getTinNumber());
-
 
273
						taxTable.setSpacingBefore(5.0f);
-
 
274
						taxTable.setWidthPercentage(90.0f);
-
 
275
						document.add(new DottedLineSeparator());
-
 
276
						document.add(taxTable);
-
 
277
					}else{
-
 
278
						PdfPTable extraInfoTable = getExtraInfoTable(order, provider, 16, warehouse.getBillingType());
-
 
279
						extraInfoTable.setSpacingBefore(5.0f);
-
 
280
						extraInfoTable.setWidthPercentage(90.0f);
-
 
281
						document.add(new DottedLineSeparator());
-
 
282
						document.add(extraInfoTable);
-
 
283
					}
268
				}
284
				}
269
				if(withBill){
285
				if(withBill){
270
					PdfPTable taxTable = getTaxCumRetailInvoiceTable(order, provider, shippingLocation.getLocation() + "-" + shippingLocation.getPincode() , shippingLocation.getTinNumber());
286
					PdfPTable taxTable = getTaxCumRetailInvoiceTable(order, provider, shippingLocation.getLocation() + "-" + shippingLocation.getPincode() , shippingLocation.getTinNumber());
271
					taxTable.setSpacingBefore(5.0f);
287
					taxTable.setSpacingBefore(5.0f);
272
					taxTable.setWidthPercentage(90.0f);
288
					taxTable.setWidthPercentage(90.0f);
Line 796... Line 812...
796
			}
812
			}
797
			orderTable.addCell(new Phrase("PaisaPayId:", helvetica8));
813
			orderTable.addCell(new Phrase("PaisaPayId:", helvetica8));
798
			orderTable.addCell(new Phrase(ebayOrder.getPaisaPayId(), helvetica8));
814
			orderTable.addCell(new Phrase(ebayOrder.getPaisaPayId(), helvetica8));
799
			orderTable.addCell(new Phrase("Sales Rec Number:", helvetica8));
815
			orderTable.addCell(new Phrase("Sales Rec Number:", helvetica8));
800
			orderTable.addCell(new Phrase(new Long(ebayOrder.getSalesRecordNumber()).toString(), helvetica8));
816
			orderTable.addCell(new Phrase(new Long(ebayOrder.getSalesRecordNumber()).toString(), helvetica8));
-
 
817
		} else if(order.getSource() == OrderSource.SNAPDEAL.getValue()){
-
 
818
			SnapdealOrder snapdealOrder = null;
-
 
819
			try {
-
 
820
				snapdealOrder = tsc.getClient().getSnapdealOrder(order.getId(), null, 0);
-
 
821
			} catch (TException e) {
-
 
822
				logger.error("Error while getting snapdeal order", e);
-
 
823
			}
-
 
824
			orderTable.addCell(new Phrase("Snapdeal OrderId:", helvetica8));
-
 
825
			orderTable.addCell(new Phrase(new Long(snapdealOrder.getSubOrderId()).toString(), helvetica8));
801
		}
826
		}
802
 
827
 
803
		orderTable.addCell(new Phrase("Order Date:", helvetica8));
828
		orderTable.addCell(new Phrase("Order Date:", helvetica8));
804
		orderTable.addCell(new Phrase(DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date(order.getCreated_timestamp())), helvetica8));
829
		orderTable.addCell(new Phrase(DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date(order.getCreated_timestamp())), helvetica8));
805
 
830