Subversion Repositories SmartDukaan

Rev

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

Rev 3132 Rev 4262
Line 196... Line 196...
196
                PdfPTable taxTable = getTaxCumRetailInvoiceTable(order, provider);
196
                PdfPTable taxTable = getTaxCumRetailInvoiceTable(order, provider);
197
                taxTable.setSpacingBefore(5.0f);
197
                taxTable.setSpacingBefore(5.0f);
198
                taxTable.setWidthPercentage(90.0f);
198
                taxTable.setWidthPercentage(90.0f);
199
                document.add(new DottedLineSeparator());
199
                document.add(new DottedLineSeparator());
200
                document.add(taxTable);
200
                document.add(taxTable);
-
 
201
            }else{
-
 
202
            	PdfPTable extraInfoTable = getExtraInfoTable(order, provider, 16);
-
 
203
            	extraInfoTable.setSpacingBefore(5.0f);
-
 
204
            	extraInfoTable.setWidthPercentage(90.0f);
-
 
205
                document.add(new DottedLineSeparator());
-
 
206
                document.add(extraInfoTable);
201
            }
207
            }
202
            document.close();
208
            document.close();
203
            baosPDF.close();
209
            baosPDF.close();
204
        } catch (Exception e) {
210
        } catch (Exception e) {
205
            logger.error("Error while generating Invoice: ", e);
211
            logger.error("Error while generating Invoice: ", e);
Line 645... Line 651...
645
        eoeCell.setColspan(colspan);
651
        eoeCell.setColspan(colspan);
646
        eoeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
652
        eoeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
647
        return eoeCell;
653
        return eoeCell;
648
    }
654
    }
649
    
655
    
-
 
656
    private PdfPTable getExtraInfoTable(Order order, Provider provider, float barcodeFontSize){
-
 
657
        PdfPTable extraInfoTable = new PdfPTable(1);
-
 
658
        extraInfoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
-
 
659
        extraInfoTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
-
 
660
 
-
 
661
        String fontPath = InvoiceGenerationService.class.getResource("/saholic.TTF").getPath();
-
 
662
        FontFactoryImp ttfFontFactory = new FontFactoryImp();
-
 
663
        ttfFontFactory.register(fontPath, "barcode");
-
 
664
        Font barCodeFont = ttfFontFactory.getFont("barcode", BaseFont.CP1252, true, barcodeFontSize);
-
 
665
        
-
 
666
        PdfPCell extraInfoCell = new PdfPCell(new Paragraph( "*" + order.getId() + "*        *" + order.getCustomer_name() + "*        *"  + order.getTotal_amount() + "*", barCodeFont));
-
 
667
        extraInfoCell.setPaddingTop(20.0f);
-
 
668
        extraInfoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-
 
669
        extraInfoCell.setBorder(Rectangle.NO_BORDER);
-
 
670
        
-
 
671
        extraInfoTable.addCell(extraInfoCell);
-
 
672
        
-
 
673
        
-
 
674
        return extraInfoTable;
-
 
675
    }
650
    public static void main(String[] args) throws IOException {
676
    public static void main(String[] args) throws IOException {
651
        InvoiceGenerationService invoiceGenerationService = new InvoiceGenerationService();
677
        InvoiceGenerationService invoiceGenerationService = new InvoiceGenerationService();
652
        long orderId = 542;
678
        long orderId = 542;
653
        ByteArrayOutputStream baos = invoiceGenerationService.generateInvoice(orderId, false);
679
        ByteArrayOutputStream baos = invoiceGenerationService.generateInvoice(orderId, false);
654
        String userHome = System.getProperty("user.home");
680
        String userHome = System.getProperty("user.home");