Subversion Repositories SmartDukaan

Rev

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

Rev 7805 Rev 7994
Line 120... Line 120...
120
	private CatalogClient ctsc = null;
120
	private CatalogClient ctsc = null;
121
 
121
 
122
	private static Locale indianLocale = new Locale("en", "IN");
122
	private static Locale indianLocale = new Locale("en", "IN");
123
	private DecimalFormat amountFormat = new DecimalFormat("#,##0.00");
123
	private DecimalFormat amountFormat = new DecimalFormat("#,##0.00");
124
 
124
 
-
 
125
	//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
126
	private static final Font helvetica6 = FontFactory.getFont(FontFactory.HELVETICA, 6);
-
 
127
	//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
125
	private static final Font helvetica8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
128
	private static final Font helvetica8 = FontFactory.getFont(FontFactory.HELVETICA, 8);
126
	private static final Font helvetica10 = FontFactory.getFont(FontFactory.HELVETICA, 10);
129
	private static final Font helvetica10 = FontFactory.getFont(FontFactory.HELVETICA, 10);
127
	private static final Font helvetica12 = FontFactory.getFont(FontFactory.HELVETICA, 12);
130
	private static final Font helvetica12 = FontFactory.getFont(FontFactory.HELVETICA, 12);
128
	private static final Font helvetica16 = FontFactory.getFont(FontFactory.HELVETICA, 16);
131
	private static final Font helvetica16 = FontFactory.getFont(FontFactory.HELVETICA, 16);
129
	private static final Font helvetica28 = FontFactory.getFont(FontFactory.HELVETICA, 28);
132
	private static final Font helvetica28 = FontFactory.getFont(FontFactory.HELVETICA, 28);
Line 299... Line 302...
299
		chargesTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
302
		chargesTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
300
		chargesTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
303
		chargesTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
301
		if(order.isLogisticsCod()){
304
		if(order.isLogisticsCod()){
302
			chargesTable.addCell(new Phrase("AMOUNT TO BE COLLECTED : Rs " + (order.getTotal_amount()-order.getGvAmount()-order.getAdvanceAmount()), helveticaBold12));
305
			chargesTable.addCell(new Phrase("AMOUNT TO BE COLLECTED : Rs " + (order.getTotal_amount()-order.getGvAmount()-order.getAdvanceAmount()), helveticaBold12));
303
			chargesTable.addCell(new Phrase("RTO ADDRESS:DEL/HPW/111116"));
306
			chargesTable.addCell(new Phrase("RTO ADDRESS:DEL/HPW/111116"));
-
 
307
			//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
308
			if(order.getLogistics_provider_id()==7L){
-
 
309
				in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
-
 
310
				String fedexCodReturnBarcode = "";
-
 
311
				try {
-
 
312
					fedexCodReturnBarcode = tclient.getOrderAttributeValue(order.getId(), "FedEx_COD_Return_BarCode");
-
 
313
				} catch (TException e1) {
-
 
314
					logger.error("Error while getting the provider information.", e1);
-
 
315
				}
-
 
316
				PdfPCell formIdCell= new PdfPCell(new Paragraph("COD Return Form id-0325", helvetica6));
-
 
317
				formIdCell.setPaddingTop(5.0f);
-
 
318
				formIdCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-
 
319
				formIdCell.setBorder(Rectangle.NO_BORDER);
-
 
320
				PdfPCell awbNumberCell= new PdfPCell(new Paragraph("*" + fedexCodReturnBarcode + "*", barCodeFont));
-
 
321
				awbNumberCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-
 
322
				awbNumberCell.setBorder(Rectangle.NO_BORDER);
-
 
323
				chargesTable.addCell(new Phrase("PRIORITY OVERNIGHT ", helvetica8));
-
 
324
				chargesTable.addCell(formIdCell);
-
 
325
				chargesTable.addCell(awbNumberCell);
-
 
326
			}
-
 
327
			//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
304
		} else {
328
		} else {
305
			chargesTable.addCell(new Phrase("Do not pay any extra charges to the Courier."));  
329
			chargesTable.addCell(new Phrase("Do not pay any extra charges to the Courier."));  
306
		}
330
		}
307
 
331
 
308
		PdfPTable addressAndNoteTable = new PdfPTable(new float[]{0.3f, 0.7f});
332
		PdfPTable addressAndNoteTable = new PdfPTable(new float[]{0.3f, 0.7f});
Line 374... Line 398...
374
			PdfPCell deliveryTypeCell = new PdfPCell(new Phrase("COD   ", helvetica28));
398
			PdfPCell deliveryTypeCell = new PdfPCell(new Phrase("COD   ", helvetica28));
375
			deliveryTypeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
399
			deliveryTypeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
376
			deliveryTypeCell.setBorder(Rectangle.NO_BORDER);
400
			deliveryTypeCell.setBorder(Rectangle.NO_BORDER);
377
			providerInfoTable.addCell(deliveryTypeCell);
401
			providerInfoTable.addCell(deliveryTypeCell);
378
		}
402
		}
-
 
403
		//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
404
		in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
-
 
405
		String fedexPackageBarcode = "";
-
 
406
		try {
-
 
407
			fedexPackageBarcode = tclient.getOrderAttributeValue(order.getId(), "FedEx_Package_BarCode");
-
 
408
		} catch (TException e1) {
-
 
409
			logger.error("Error while getting the provider information.", e1);
379
		
410
		}
-
 
411
		//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
380
		
412
		
381
		
413
		
382
		
414
		
383
		PdfPCell providerNameCell = new PdfPCell(new Phrase(provider.getName(), helveticaBold12));
415
		PdfPCell providerNameCell = new PdfPCell(new Phrase(provider.getName(), helveticaBold12));
384
		providerNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
416
		providerNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
385
		providerNameCell.setBorder(Rectangle.NO_BORDER);
417
		providerNameCell.setBorder(Rectangle.NO_BORDER);
-
 
418
		//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
419
		PdfPCell formIdCell= null;
-
 
420
		if(order.getLogistics_provider_id()==7L){
-
 
421
			if(order.isCod()){
-
 
422
				formIdCell = new PdfPCell(new Paragraph("Form id-0305", helvetica6));
-
 
423
			}
-
 
424
			else{
-
 
425
				formIdCell = new PdfPCell(new Paragraph("Form id-0467", helvetica6));
-
 
426
			}
-
 
427
		}
-
 
428
		formIdCell.setPaddingTop(20.0f);
-
 
429
		formIdCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-
 
430
		formIdCell.setBorder(Rectangle.NO_BORDER);
386
 
431
	
-
 
432
		PdfPCell awbNumberCell= null;
-
 
433
		if(order.getLogistics_provider_id()!=7L){
387
		PdfPCell awbNumberCell = new PdfPCell(new Paragraph("*" + order.getAirwaybill_no() + "*", barCodeFont));
434
			awbNumberCell = new PdfPCell(new Paragraph("*" + order.getAirwaybill_no() + "*", barCodeFont));
-
 
435
		}
-
 
436
		else{
-
 
437
			awbNumberCell = new PdfPCell(new Paragraph("*" + fedexPackageBarcode + "*", barCodeFont));
-
 
438
		}
388
		awbNumberCell.setPaddingTop(20.0f);
439
		//awbNumberCell.setPaddingTop(20.0f);
389
		awbNumberCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
440
		awbNumberCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
390
		awbNumberCell.setBorder(Rectangle.NO_BORDER);
441
		awbNumberCell.setBorder(Rectangle.NO_BORDER);
391
 
442
 
392
		providerInfoTable.addCell(providerNameCell);
443
		providerInfoTable.addCell(providerNameCell);
-
 
444
		providerInfoTable.addCell(formIdCell);
-
 
445
		//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
393
		providerInfoTable.addCell(awbNumberCell);
446
		providerInfoTable.addCell(awbNumberCell);
394
		
447
		
395
		Warehouse warehouse = null;
448
		Warehouse warehouse = null;
396
		try{
449
		try{
397
    		InventoryClient isc = new InventoryClient();
450
    		InventoryClient isc = new InventoryClient();
Line 403... Line 456...
403
		String accountNo = "";
456
		String accountNo = "";
404
		DeliveryType dt =  DeliveryType.PREPAID;
457
		DeliveryType dt =  DeliveryType.PREPAID;
405
        if (order.isLogisticsCod()) {
458
        if (order.isLogisticsCod()) {
406
            dt = DeliveryType.COD;
459
            dt = DeliveryType.COD;
407
        }
460
        }
-
 
461
        //Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
462
        if(order.getLogistics_provider_id()!=7L){
408
        for (ProviderDetails detail : provider.getDetails()) {
463
	        for (ProviderDetails detail : provider.getDetails()) {
409
            if(in.shop2020.model.v1.inventory.WarehouseLocation.findByValue((int) detail.getLogisticLocation()) == warehouse.getLogisticsLocation() && detail.getDeliveryType() == dt) {
464
	            if(in.shop2020.model.v1.inventory.WarehouseLocation.findByValue((int) detail.getLogisticLocation()) == warehouse.getLogisticsLocation() && detail.getDeliveryType() == dt) {
410
                providerInfoTable.addCell(new Phrase("Account No : " + detail.getAccountNo(), helvetica8));
465
	                providerInfoTable.addCell(new Phrase("Account No : " + detail.getAccountNo(), helvetica8));
411
            }
466
	            }
-
 
467
	        }
412
        }
468
        }
-
 
469
        else{
-
 
470
        	providerInfoTable.addCell(new Phrase("STANDARD OVERNIGHT ", helvetica8));
413
		
471
        }
-
 
472
        //End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
414
		Date awbDate;
473
		Date awbDate;
415
		if(order.getBilling_timestamp() == 0){
474
		if(order.getBilling_timestamp() == 0){
416
			awbDate = new Date();
475
			awbDate = new Date();
417
		}else{
476
		}else{
418
			awbDate = new Date(order.getBilling_timestamp());
477
			awbDate = new Date(order.getBilling_timestamp());
419
		}
478
		}
420
		providerInfoTable.addCell(new Phrase("AWB Date   : " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(awbDate), helvetica8));
479
		providerInfoTable.addCell(new Phrase("AWB Date   : " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(awbDate), helvetica8));
421
		providerInfoTable.addCell(new Phrase("Weight         : " + order.getTotal_weight() + " Kg", helvetica8));
480
		providerInfoTable.addCell(new Phrase("Weight         : " + order.getTotal_weight() + " Kg", helvetica8));
-
 
481
		//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
482
		if(order.getLogistics_provider_id()==7L){
-
 
483
			providerInfoTable.addCell(new Phrase("Bill T/C Sender      "+ "Bill D/T Sender", helvetica8));
-
 
484
		}
-
 
485
		//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
422
		return providerInfoTable;
486
		return providerInfoTable;
423
	}
487
	}
424
 
488
 
425
	private PdfPTable getTopInvoiceTable(Order order, String tinNo){
489
	private PdfPTable getTopInvoiceTable(Order order, String tinNo){
426
		PdfPTable invoiceTable = new PdfPTable(new float[]{0.2f, 0.2f, 0.3f, 0.1f, 0.1f, 0.1f});
490
		PdfPTable invoiceTable = new PdfPTable(new float[]{0.2f, 0.2f, 0.3f, 0.1f, 0.1f, 0.1f});
Line 546... Line 610...
546
		if(forInvoce || order.getPickupStoreId() == 0){
610
		if(forInvoce || order.getPickupStoreId() == 0){
547
			customerTable.addCell(new Phrase(order.getCustomer_name(), font));
611
			customerTable.addCell(new Phrase(order.getCustomer_name(), font));
548
			customerTable.addCell(new Phrase(order.getCustomer_address1(), font));
612
			customerTable.addCell(new Phrase(order.getCustomer_address1(), font));
549
			customerTable.addCell(new Phrase(order.getCustomer_address2(), font));
613
			customerTable.addCell(new Phrase(order.getCustomer_address2(), font));
550
			customerTable.addCell(new Phrase(order.getCustomer_city() + "," + order.getCustomer_state(), font));
614
			customerTable.addCell(new Phrase(order.getCustomer_city() + "," + order.getCustomer_state(), font));
-
 
615
			//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
616
			if(order.getLogistics_provider_id()!=7L){
551
			if(destCode != null)
617
				if(destCode != null)
552
				customerTable.addCell(new Phrase(order.getCustomer_pincode() + " - " + destCode, helvetica16));
618
					customerTable.addCell(new Phrase(order.getCustomer_pincode() + " - " + destCode, helvetica16));
553
			else
619
				else
554
				customerTable.addCell(new Phrase(order.getCustomer_pincode(), font));
620
					customerTable.addCell(new Phrase(order.getCustomer_pincode(), font));
-
 
621
				}
-
 
622
			else{
-
 
623
				in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
-
 
624
				String fedexLocationcode = "";
-
 
625
				try {
-
 
626
					fedexLocationcode = tclient.getOrderAttributeValue(order.getId(), "FedEx_Location_Code");
-
 
627
				} catch (TException e1) {
-
 
628
					logger.error("Error while getting the provider information.", e1);
-
 
629
				}
-
 
630
				customerTable.addCell(new Phrase(order.getCustomer_pincode() + " - " + fedexLocationcode, helvetica16));
-
 
631
			}
-
 
632
			//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
555
			customerTable.addCell(new Phrase("Phone :" + order.getCustomer_mobilenumber(), font));
633
			customerTable.addCell(new Phrase("Phone :" + order.getCustomer_mobilenumber(), font));
556
		}else{
634
		}else{
557
			try {
635
			try {
558
				in.shop2020.logistics.LogisticsService.Client lclient = (new LogisticsClient()).getClient();
636
				in.shop2020.logistics.LogisticsService.Client lclient = (new LogisticsClient()).getClient();
559
				PickupStore store = lclient.getPickupStore(order.getPickupStoreId());
637
				PickupStore store = lclient.getPickupStore(order.getPickupStoreId());