Subversion Repositories SmartDukaan

Rev

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

Rev 8101 Rev 8102
Line 266... Line 266...
266
		Font barCodeFont = getBarCodeFont(provider, barcodeFontSize);
266
		Font barCodeFont = getBarCodeFont(provider, barcodeFontSize);
267
 
267
 
268
		PdfPTable table = new PdfPTable(1);
268
		PdfPTable table = new PdfPTable(1);
269
		table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
269
		table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
270
 
270
 
271
		//PdfPTable logoTable = addLogoTable(order); 
271
		PdfPTable logoTable = addLogoTable(order); 
272
		PdfPTable logoTable = new PdfPTable(2);
-
 
273
		logoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
-
 
274
		logoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
-
 
275
		logoTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
-
 
276
				
-
 
277
		PdfPCell logoCell = new PdfPCell(new Phrase(""));
-
 
278
		String logoPath;
-
 
279
		Image logo=null;
-
 
280
		logger.info("Order Source Value........."+order.getSource());
-
 
281
		if(order.getSource() == OrderSource.STORE.getValue()){
-
 
282
			
-
 
283
			
-
 
284
		}else{
-
 
285
			logoPath = InvoiceGenerationService.class.getResource("/logo.png").getPath();
-
 
286
			logger.info("Logo Path........."+logoPath);
-
 
287
			
-
 
288
			try {
-
 
289
				logo = Image.getInstance(logoPath);
-
 
290
			} catch (Exception e) {
-
 
291
				//Too Many exceptions to catch here: BadElementException, MalformedURLException and IOException
-
 
292
				logger.warn("Couldn't load the Saholic logo: ", e);
-
 
293
				logoCell = new PdfPCell(new Phrase("Saholic Logo"));
-
 
294
			}
-
 
295
		
-
 
296
		}
-
 
297
		logoCell.setBorder(Rectangle.NO_BORDER);
-
 
298
		logoCell.setHorizontalAlignment(Element.ALIGN_LEFT);
-
 
299
		if(logo!=null)
-
 
300
			logoTable.addCell(logo);
-
 
301
		else{
-
 
302
			logoTable.addCell(logoCell);
-
 
303
		}
-
 
304
		
272
		
305
		PdfPCell titleCell = getTitleCell();
273
		PdfPCell titleCell = getTitleCell();
306
		PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12, false);
274
		PdfPTable customerTable = getCustomerAddressTable(order, destCode, false, helvetica12, false);
307
		PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont);
275
		PdfPTable providerInfoTable = getProviderTable(order, provider, barCodeFont);
308
 
276
 
Line 387... Line 355...
387
		logoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
355
		logoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
388
		logoTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
356
		logoTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
389
				
357
				
390
		PdfPCell logoCell;
358
		PdfPCell logoCell;
391
		String logoPath;
359
		String logoPath;
392
		Image logo=null;
360
		
393
		logger.info("Order Source Value........."+order.getSource());
-
 
394
		if(order.getSource() == OrderSource.STORE.getValue()){
361
		if(order.getSource() == OrderSource.STORE.getValue()){
395
			logoCell = new PdfPCell(new Phrase(""));
362
			logoCell = new PdfPCell(new Phrase(""));
396
			
363
			
397
		}else{
364
		}else{
398
			logoPath = InvoiceGenerationService.class.getResource("/logo.png").getPath();
365
			logoPath = InvoiceGenerationService.class.getResource("/logo.jpg").getPath();
399
			logger.info("Logo Path........."+logoPath);
-
 
400
			
366
			
401
			try {
367
			try {
402
				logoCell = new PdfPCell(Image.getInstance(logoPath), false);
368
				logoCell = new PdfPCell(Image.getInstance(logoPath), false);
403
				logo = Image.getInstance(logoPath);
-
 
404
			} catch (Exception e) {
369
			} catch (Exception e) {
405
				//Too Many exceptions to catch here: BadElementException, MalformedURLException and IOException
370
				//Too Many exceptions to catch here: BadElementException, MalformedURLException and IOException
406
				logger.warn("Couldn't load the Saholic logo: ", e);
371
				logger.warn("Couldn't load the Saholic logo: ", e);
407
				logoCell = new PdfPCell(new Phrase("Saholic Logo"));
372
				logoCell = new PdfPCell(new Phrase("Saholic Logo"));
408
			}
373
			}
409
		
374
		
410
		}
375
		}
411
		logoCell.setBorder(Rectangle.NO_BORDER);
376
		logoCell.setBorder(Rectangle.NO_BORDER);
412
		logoCell.setHorizontalAlignment(Element.ALIGN_LEFT);
377
		logoCell.setHorizontalAlignment(Element.ALIGN_LEFT);
413
		if(logo!=null)
-
 
414
			logoTable.addCell(logo);
378
		logoTable.addCell(logoCell);
415
		else{
-
 
416
			logoTable.addCell(logoCell);
379
		logoTable.addCell(" ");
417
		}
-
 
418
		return logoTable;
380
		return logoTable;
419
	}
381
	}
420
 
382
 
421
	private Font getBarCodeFont(Provider provider, float barcodeFontSize) {
383
	private Font getBarCodeFont(Provider provider, float barcodeFontSize) {
422
		String fontPath = InvoiceGenerationService.class.getResource("/" + provider.getName().toLowerCase() + "/barcode.TTF").getPath();
384
		String fontPath = InvoiceGenerationService.class.getResource("/" + provider.getName().toLowerCase() + "/barcode.TTF").getPath();